public ProgressEvent handleRequest()

in reportdefinition/src/main/java/software/amazon/cur/reportdefinition/CreateHandler.java [16:43]


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

        final ResourceModel model = request.getDesiredResourceState();
        final ReportDefinition reportDefinition = Translator.toReportDefinition(model);
        final CostAndUsageReportClient curClient = getClient(request);

        try {
            proxy.injectCredentialsAndInvokeV2(
                PutReportDefinitionRequest.builder()
                    .reportDefinition(reportDefinition)
                    .build(),
                curClient::putReportDefinition
            );

            return ProgressEvent.<ResourceModel, CallbackContext>builder()
                // Translate the translated ReportDefinition back to a ResourceModel so that the model returned
                // here includes any of the defaults not specified in the request's ResourceModel
                .resourceModel(Translator.toResourceModel(reportDefinition))
                .status(OperationStatus.SUCCESS)
                .build();
        } catch (CostAndUsageReportException e) {
            throw ExceptionTranslator.toCfnException(e, model.getReportName());
        }
    }