public ProgressEvent handleRequest()

in aws-customerprofiles-objecttype/src/main/java/software/amazon/customerprofiles/objecttype/DeleteHandler.java [30:67]


    public ProgressEvent<ResourceModel, CallbackContext> handleRequest(
            final AmazonWebServicesClientProxy proxy,
            final ResourceHandlerRequest<ResourceModel> request,
            final CallbackContext callbackContext,
            final Logger logger) {

        if (this.client == null) {
            this.client = ClientBuilder.getClient();
        }

        final ResourceModel model = request.getDesiredResourceState();

        final DeleteProfileObjectTypeRequest deleteProfileObjectTypeRequest = DeleteProfileObjectTypeRequest.builder()
                .domainName(model.getDomainName())
                .objectTypeName(model.getObjectTypeName())
                .build();

        final DeleteProfileObjectTypeResponse deleteProfileObjectTypeResponse;
        try {
            deleteProfileObjectTypeResponse = proxy.injectCredentialsAndInvokeV2(deleteProfileObjectTypeRequest, client::deleteProfileObjectType);
            logger.log(String.format("ProfileObjectType deleted with domainName = %s, profileObjectTypeName = %s",
                    model.getDomainName(), model.getObjectTypeName()));
        } catch (BadRequestException e) {
            throw new CfnInvalidRequestException(e);
        } catch (InternalServerException e) {
            throw new CfnServiceInternalErrorException(e);
        } catch (ResourceNotFoundException e) {
            throw new CfnNotFoundException(e);
        } catch (Exception e) {
            throw new CfnGeneralServiceException(e);
        }

        return ProgressEvent.<ResourceModel, CallbackContext>builder()
                .resourceModel(null)
                .status(OperationStatus.SUCCESS)
                .message(deleteProfileObjectTypeResponse.message())
                .build();
    }