public ProgressEvent handleRequest()

in aws-customerprofiles-integration/src/main/java/software/amazon/customerprofiles/integration/ReadHandler.java [29:72]


    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 requestModel = request.getDesiredResourceState();

        final GetIntegrationRequest getIntegrationRequest = GetIntegrationRequest.builder()
                .domainName(requestModel.getDomainName())
                .uri(requestModel.getUri())
                .build();

        final GetIntegrationResponse getIntegrationResponse;
        try {
            getIntegrationResponse = proxy.injectCredentialsAndInvokeV2(getIntegrationRequest, client::getIntegration);
            logger.log(String.format("Get Integration with domainName = %s, uri = %s",
                    requestModel.getDomainName(), requestModel.getUri()));
        } 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);
        }

        final ResourceModel responseModel = ResourceModel.builder()
                .createdAt(getIntegrationResponse.createdAt().toString())
                .domainName(getIntegrationResponse.domainName())
                .lastUpdatedAt(getIntegrationResponse.lastUpdatedAt().toString())
                .objectTypeName(getIntegrationResponse.objectTypeName())
                .tags(Translator.mapTagsToList(getIntegrationResponse.tags()))
                .uri(getIntegrationResponse.uri())
                .objectTypeNames(Translator.mapObjectTypeNamesToList(getIntegrationResponse.objectTypeNames()))
                .build();

        return ProgressEvent.defaultSuccessHandler(responseModel);
    }