private ProgressEvent createResource()

in aws-ecr-registrypolicy/src/main/java/software/amazon/ecr/registrypolicy/CreateHandler.java [70:93]


    private ProgressEvent<ResourceModel, CallbackContext> createResource(
            final AmazonWebServicesClientProxy proxy,
            final ProxyClient<EcrClient> proxyClient,
            final ProgressEvent<ResourceModel, CallbackContext> progressEvent,
            final Logger logger) {

        return progressEvent.then(progress ->
                proxy.initiate("AWS-ECR-RegistryPolicy::Create", proxyClient, progress.getResourceModel(),
                        progress.getCallbackContext())
                        .translateToServiceRequest(Translator::translateToPutRequest)
                        .makeServiceCall((awsRequest, client) -> {
                            PutRegistryPolicyResponse response = proxy.injectCredentialsAndInvokeV2(awsRequest,
                                    proxyClient.client()::putRegistryPolicy);
                            logger.log(ResourceModel.TYPE_NAME + " successfully created.");
                            return response;
                        })
                        .handleError((awsRequest, exception, client, model, context) ->
                                this.handleError(exception, model,context))
                        .done(awsResponse -> ProgressEvent.<ResourceModel, CallbackContext>builder()
                                .status(OperationStatus.SUCCESS)
                                .resourceModel(progress.getResourceModel())
                                .build())
        );
    }