protected ProgressEvent handleRequest()

in aws-events-connection/src/main/java/software/amazon/events/connection/CreateHandler.java [32:71]


    protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
            final AmazonWebServicesClientProxy proxy,
            final ResourceHandlerRequest<ResourceModel> request,
            final CallbackContext callbackContext,
            final ProxyClient<EventBridgeClient> proxyClient,
            final Logger logger) {

        this.logger = logger;

        final ResourceModel model = request.getDesiredResourceState();
        logger.log(String.format("Resource module: %s", model.toString()));

        Utils.verifyAuthorizationTypeParameterMapping(model);

        if (StringUtils.isNullOrEmpty(model.getName())) {
            model.setName(
                    IdentifierUtils.generateResourceIdentifier(
                            request.getLogicalResourceIdentifier(), request.getClientRequestToken(), MAX_CONNECTION_NAME_LENGTH));
        }

        return ProgressEvent.progress(model, callbackContext)
                .then(progress ->
                        proxy.initiate("AWS-Events-Connection::Create", proxyClient, progress.getResourceModel(), progress.getCallbackContext())

                                .translateToServiceRequest(Translator::translateToCreateRequest)
                                .makeServiceCall(this::createResource)
                                .progress()
                )
                .then(progress ->
                        // If your resource requires some form of stabilization (e.g. service does not provide strong consistency), you will need to ensure that your code
                        // accounts for any potential issues, so that a subsequent read/update requests will not cause any conflicts (e.g. NotFoundException/InvalidRequestException)
                        proxy.initiate("AWS-Events-Connection::PostCreateStabilize", proxyClient, progress.getResourceModel(), progress.getCallbackContext())
                                .translateToServiceRequest(Function.identity())
                                .backoffDelay(BACK_OFF_DELAY)
                                .makeServiceCall(EMPTY_CALL)
                                .stabilize((awsRequest, response, proxyInvocation, resourceModel, context) -> isStabilized(proxyClient, resourceModel))
                                .progress())
                .then(progress -> new ReadHandler().handleRequest(proxy, request, callbackContext, proxyClient, logger));

    }