public ProgressEvent handleRequest()

in aws-ssm-association/src/main/java/com/amazonaws/ssm/association/InProgressHandler.java [58:107]


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

        final String associationId = callbackContext.getAssociationId();
        final DescribeAssociationRequest describeAssociationRequest =
            DescribeAssociationRequest.builder()
                .associationId(associationId)
                .build();

        final AssociationDescription requestAssociation;

        try {
            requestAssociation =
                proxy.injectCredentialsAndInvokeV2(describeAssociationRequest, ssmClient::describeAssociation)
                    .associationDescription();

        } catch (Exception e) {
            final BaseHandlerException cfnException = exceptionTranslator
                .translateFromServiceException(e, describeAssociationRequest, request.getDesiredResourceState());

            logger.log(cfnException.getCause().getMessage());

            throw cfnException;
        }

        final ResourceModel existingModel =
            associationDescriptionTranslator.associationDescriptionToResourceModel(requestAssociation);

        if (AssociationStatusName.SUCCESS.name()
            .equalsIgnoreCase(requestAssociation.overview().status())) {

            return ProgressEvent.defaultSuccessHandler(existingModel);

        } else if (AssociationStatusName.PENDING.name()
            .equalsIgnoreCase(requestAssociation.overview().status())) {

            final int remainingTimeoutSeconds = callbackContext.getRemainingTimeoutSeconds();

            if (remainingTimeoutSeconds <= 0) {
                throw new CfnNotStabilizedException(ResourceModel.TYPE_NAME, associationId);
            }

            return inProgressEventCreator.nextInProgressEvent(remainingTimeoutSeconds, existingModel);
        } else {
            throw new CfnNotStabilizedException(ResourceModel.TYPE_NAME, associationId);
        }
    }