protected ProgressEvent handleRequest()

in aws-sagemaker-domain/src/main/java/software/amazon/sagemaker/domain/CreateHandler.java [26:68]


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

        this.logger = logger;

        final ResourceModel model = request.getDesiredResourceState();

        // read only properties are not allowed to be set by the user during creation.
        // https://github.com/aws-cloudformation/aws-cloudformation-resource-schema/issues/102
        if (callbackContext.callGraphs().isEmpty()) {
            if (model.getDomainArn() != null) {
                throw new CfnInvalidRequestException(String.format(READ_ONLY_PROPERTY_ERROR_MESSAGE, "DomainArn"));
            }

            if (model.getDomainId() != null) {
                throw new CfnInvalidRequestException(String.format(READ_ONLY_PROPERTY_ERROR_MESSAGE, "DomainId"));
            }

            if (model.getUrl() != null) {
                throw new CfnInvalidRequestException(String.format(READ_ONLY_PROPERTY_ERROR_MESSAGE, "Url"));
            }

            if (model.getHomeEfsFileSystemId() != null) {
                throw new CfnInvalidRequestException(String.format(READ_ONLY_PROPERTY_ERROR_MESSAGE, "HomeEfsFileSystemId"));
            }

            if (model.getSingleSignOnManagedApplicationInstanceId() != null) {
                throw new CfnInvalidRequestException(String.format(READ_ONLY_PROPERTY_ERROR_MESSAGE, "SingleSignOnManagedApplicationInstanceId"));
            }
        }

        return ProgressEvent.progress(model, callbackContext)
                .then(progress -> proxy.initiate(OPERATION, proxyClient, model, callbackContext)
                        .translateToServiceRequest(TranslatorForRequest::translateToCreateRequest)
                        .makeServiceCall(this::createResource)
                        .stabilize(this::stabilizedOnCreate)
                        .done(createResponse -> constructResourceModelFromResponse(createResponse, model, proxyClient))
                );
    }