private CreateOpsMetadataResponse createResource()

in aws-ssm-opsmetadata/src/main/java/com/amazonaws/ssm/opsmetadata/CreateHandler.java [63:82]


    private CreateOpsMetadataResponse createResource(final CreateOpsMetadataRequest createOpsMetadataRequest,
                                                     final ProxyClient<SsmClient> proxyClient) {
        try {
            return proxyClient.injectCredentialsAndInvokeV2(createOpsMetadataRequest, proxyClient.client()::createOpsMetadata);
        } catch (final OpsMetadataAlreadyExistsException exception) {
            throw new CfnAlreadyExistsException(ResourceModel.TYPE_NAME, createOpsMetadataRequest.resourceId());
        } catch (final InternalServerErrorException exception) {
            throw new CfnServiceInternalErrorException(OPERATION, exception);
        } catch (final AmazonServiceException exception) {
            final Integer errorStatus = exception.getStatusCode();
            final String errorCode = exception.getErrorCode();
            if (errorStatus >= Constants.ERROR_STATUS_CODE_400 && errorStatus < Constants.ERROR_STATUS_CODE_500) {
                if (THROTTLING_ERROR_CODES.contains(errorCode)) {
                    logger.log(String.format(RETRY_MESSAGE, exception.getMessage()));
                    throw new CfnThrottlingException(OPERATION, exception);
                }
            }
            throw new CfnGeneralServiceException(OPERATION, exception);
        }
    }