public ProgressEvent handleRequest()

in aws-iot-jobtemplate/src/main/java/software/amazon/iot/jobtemplate/ReadHandler.java [41:92]


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

        final ResourceModel model = request.getDesiredResourceState();

        final DescribeJobTemplateRequest describeJobTemplateRequest = DescribeJobTemplateRequest.builder()
                .jobTemplateId(model.getJobTemplateId())
                .build();

        try {
            DescribeJobTemplateResponse response = proxy.injectCredentialsAndInvokeV2(describeJobTemplateRequest, iotClient::describeJobTemplate);
            logger.log(String.format("%s [%s] read successfully", ResourceModel.TYPE_NAME, model.getJobTemplateId()));

            AbortConfig abortConfig = getAbortConfig(response.abortConfig());
            JobExecutionsRolloutConfig rolloutConfig = getJobExecutionsRolloutConfig(response.jobExecutionsRolloutConfig());
            PresignedUrlConfig presignedUrlConfig = getPresignedUrlConfig(response.presignedUrlConfig());
            TimeoutConfig timeoutConfig = getTimeoutConfig(response.timeoutConfig());


            return ProgressEvent.defaultSuccessHandler(ResourceModel.builder()
                    .arn(response.jobTemplateArn())
                    .jobTemplateId(response.jobTemplateId())
                    .abortConfig(abortConfig)
                    .description(response.description())
                    .document(response.document())
                    .documentSource(response.documentSource())
                    .jobExecutionsRolloutConfig(rolloutConfig)
                    .jobTemplateId(response.jobTemplateId())
                    .presignedUrlConfig(presignedUrlConfig)
                    .timeoutConfig(timeoutConfig)
                    .build());
        } catch (final ResourceNotFoundException e){
            throw new CfnNotFoundException(ResourceModel.TYPE_NAME, model.getJobTemplateId());
        } catch (final InvalidRequestException e) {
            throw new CfnInvalidRequestException(e.getMessage(), e);
        } catch (final LimitExceededException e) {
            throw new CfnServiceLimitExceededException(ResourceModel.TYPE_NAME, e.getMessage());
        } catch (final InternalFailureException e) {
            throw new CfnServiceInternalErrorException(OPERATION, e);
        } catch (final ThrottlingException e) {
            throw new CfnThrottlingException(OPERATION, e);
        } catch (final ServiceUnavailableException e) {
            throw new CfnGeneralServiceException(OPERATION, e);
        } catch (final UnauthorizedException e) {
            throw new CfnAccessDeniedException(OPERATION, e);
        } catch (final Exception e) {
            throw new CfnInternalFailureException(e);
        }
    }