public static ProgressEvent handleCreateStabilizeRequest()

in aws-servicecatalog-serviceactionassociation/src/main/java/software/amazon/servicecatalog/serviceactionassociation/stabilizer/Stabilization.java [22:46]


    public static ProgressEvent<ResourceModel, CallbackContext> handleCreateStabilizeRequest(final ActionAssociationController actionController, final ResourceHandlerRequest<ResourceModel> request,
                                                                                             final CallbackContext callbackContext,
                                                                                             final Logger logger) {
        final ResourceModel model = request.getDesiredResourceState();
        if (callbackContext.getStabilizationRetriesRemaining() == 0) {
            logger.log("Create retries remaining zero");
            throw new CfnNotStabilizedException(ResourceModel.TYPE_NAME, callbackContext.getServiceActionId());
        }
        try {
            final boolean isMatch = actionController.isServiceActionAssociatedToPA(callbackContext.getProductId(), callbackContext.getProvisioningArtifactId(), callbackContext.getServiceActionId());
            logger.log(String.format(CREATE_RETRIES, callbackContext.getStabilizationRetriesRemaining()));
            if(isMatch){
                return ProgressEvent.defaultSuccessHandler(model);
            } else {
                return ProgressEvent.defaultInProgressHandler(
                        callbackContext.toBuilder()
                                .stabilizationRetriesRemaining(callbackContext.getStabilizationRetriesRemaining() - 1)
                                .build(),
                        POLL_RETRY_DELAY_SECONDS,
                        model);
            }
        } catch (ResourceNotFoundException ex) {
            throw new CfnNotFoundException(ResourceModel.TYPE_NAME, callbackContext.getServiceActionId(), ex);
        }
    }