All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.dataexchange.DefaultDataExchangeClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for DataExchange module holds the client classes that are used for communicating with DataExchange.

There is a newer version: 2.28.5
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.dataexchange;

import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.awscore.retry.AwsRetryStrategy;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.retry.RetryMode;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.dataexchange.internal.DataExchangeServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.dataexchange.model.AccessDeniedException;
import software.amazon.awssdk.services.dataexchange.model.CancelJobRequest;
import software.amazon.awssdk.services.dataexchange.model.CancelJobResponse;
import software.amazon.awssdk.services.dataexchange.model.ConflictException;
import software.amazon.awssdk.services.dataexchange.model.CreateDataSetRequest;
import software.amazon.awssdk.services.dataexchange.model.CreateDataSetResponse;
import software.amazon.awssdk.services.dataexchange.model.CreateEventActionRequest;
import software.amazon.awssdk.services.dataexchange.model.CreateEventActionResponse;
import software.amazon.awssdk.services.dataexchange.model.CreateJobRequest;
import software.amazon.awssdk.services.dataexchange.model.CreateJobResponse;
import software.amazon.awssdk.services.dataexchange.model.CreateRevisionRequest;
import software.amazon.awssdk.services.dataexchange.model.CreateRevisionResponse;
import software.amazon.awssdk.services.dataexchange.model.DataExchangeException;
import software.amazon.awssdk.services.dataexchange.model.DeleteAssetRequest;
import software.amazon.awssdk.services.dataexchange.model.DeleteAssetResponse;
import software.amazon.awssdk.services.dataexchange.model.DeleteDataSetRequest;
import software.amazon.awssdk.services.dataexchange.model.DeleteDataSetResponse;
import software.amazon.awssdk.services.dataexchange.model.DeleteEventActionRequest;
import software.amazon.awssdk.services.dataexchange.model.DeleteEventActionResponse;
import software.amazon.awssdk.services.dataexchange.model.DeleteRevisionRequest;
import software.amazon.awssdk.services.dataexchange.model.DeleteRevisionResponse;
import software.amazon.awssdk.services.dataexchange.model.GetAssetRequest;
import software.amazon.awssdk.services.dataexchange.model.GetAssetResponse;
import software.amazon.awssdk.services.dataexchange.model.GetDataSetRequest;
import software.amazon.awssdk.services.dataexchange.model.GetDataSetResponse;
import software.amazon.awssdk.services.dataexchange.model.GetEventActionRequest;
import software.amazon.awssdk.services.dataexchange.model.GetEventActionResponse;
import software.amazon.awssdk.services.dataexchange.model.GetJobRequest;
import software.amazon.awssdk.services.dataexchange.model.GetJobResponse;
import software.amazon.awssdk.services.dataexchange.model.GetRevisionRequest;
import software.amazon.awssdk.services.dataexchange.model.GetRevisionResponse;
import software.amazon.awssdk.services.dataexchange.model.InternalServerException;
import software.amazon.awssdk.services.dataexchange.model.ListDataSetRevisionsRequest;
import software.amazon.awssdk.services.dataexchange.model.ListDataSetRevisionsResponse;
import software.amazon.awssdk.services.dataexchange.model.ListDataSetsRequest;
import software.amazon.awssdk.services.dataexchange.model.ListDataSetsResponse;
import software.amazon.awssdk.services.dataexchange.model.ListEventActionsRequest;
import software.amazon.awssdk.services.dataexchange.model.ListEventActionsResponse;
import software.amazon.awssdk.services.dataexchange.model.ListJobsRequest;
import software.amazon.awssdk.services.dataexchange.model.ListJobsResponse;
import software.amazon.awssdk.services.dataexchange.model.ListRevisionAssetsRequest;
import software.amazon.awssdk.services.dataexchange.model.ListRevisionAssetsResponse;
import software.amazon.awssdk.services.dataexchange.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.dataexchange.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.dataexchange.model.ResourceNotFoundException;
import software.amazon.awssdk.services.dataexchange.model.RevokeRevisionRequest;
import software.amazon.awssdk.services.dataexchange.model.RevokeRevisionResponse;
import software.amazon.awssdk.services.dataexchange.model.SendDataSetNotificationRequest;
import software.amazon.awssdk.services.dataexchange.model.SendDataSetNotificationResponse;
import software.amazon.awssdk.services.dataexchange.model.ServiceLimitExceededException;
import software.amazon.awssdk.services.dataexchange.model.StartJobRequest;
import software.amazon.awssdk.services.dataexchange.model.StartJobResponse;
import software.amazon.awssdk.services.dataexchange.model.TagResourceRequest;
import software.amazon.awssdk.services.dataexchange.model.TagResourceResponse;
import software.amazon.awssdk.services.dataexchange.model.ThrottlingException;
import software.amazon.awssdk.services.dataexchange.model.UntagResourceRequest;
import software.amazon.awssdk.services.dataexchange.model.UntagResourceResponse;
import software.amazon.awssdk.services.dataexchange.model.UpdateAssetRequest;
import software.amazon.awssdk.services.dataexchange.model.UpdateAssetResponse;
import software.amazon.awssdk.services.dataexchange.model.UpdateDataSetRequest;
import software.amazon.awssdk.services.dataexchange.model.UpdateDataSetResponse;
import software.amazon.awssdk.services.dataexchange.model.UpdateEventActionRequest;
import software.amazon.awssdk.services.dataexchange.model.UpdateEventActionResponse;
import software.amazon.awssdk.services.dataexchange.model.UpdateRevisionRequest;
import software.amazon.awssdk.services.dataexchange.model.UpdateRevisionResponse;
import software.amazon.awssdk.services.dataexchange.model.ValidationException;
import software.amazon.awssdk.services.dataexchange.transform.CancelJobRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.CreateDataSetRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.CreateEventActionRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.CreateJobRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.CreateRevisionRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.DeleteAssetRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.DeleteDataSetRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.DeleteEventActionRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.DeleteRevisionRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.GetAssetRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.GetDataSetRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.GetEventActionRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.GetJobRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.GetRevisionRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.ListDataSetRevisionsRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.ListDataSetsRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.ListEventActionsRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.ListJobsRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.ListRevisionAssetsRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.RevokeRevisionRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.SendDataSetNotificationRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.StartJobRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.UpdateAssetRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.UpdateDataSetRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.UpdateEventActionRequestMarshaller;
import software.amazon.awssdk.services.dataexchange.transform.UpdateRevisionRequestMarshaller;
import software.amazon.awssdk.utils.Logger;

/**
 * Internal implementation of {@link DataExchangeClient}.
 *
 * @see DataExchangeClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultDataExchangeClient implements DataExchangeClient {
    private static final Logger log = Logger.loggerFor(DefaultDataExchangeClient.class);

    private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
            .serviceProtocol(AwsServiceProtocol.REST_JSON).build();

    private final SyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultDataExchangeClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* This operation cancels a job. Jobs can be cancelled only when they are in the WAITING state. *

* * @param cancelJobRequest * @return Result of the CancelJob operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ConflictException * The request couldn't be completed because it conflicted with the current state of the resource. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.CancelJob * @see AWS API * Documentation */ @Override public CancelJobResponse cancelJob(CancelJobRequest cancelJobRequest) throws ResourceNotFoundException, ThrottlingException, ConflictException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CancelJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(cancelJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelJob"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CancelJob").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(cancelJobRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new CancelJobRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation creates a data set. *

* * @param createDataSetRequest * @return Result of the CreateDataSet operation returned by the service. * @throws ServiceLimitExceededException * The request has exceeded the quotas imposed by the service. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.CreateDataSet * @see AWS * API Documentation */ @Override public CreateDataSetResponse createDataSet(CreateDataSetRequest createDataSetRequest) throws ServiceLimitExceededException, ThrottlingException, AccessDeniedException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateDataSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createDataSetRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createDataSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDataSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateDataSet").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createDataSetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateDataSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation creates an event action. *

* * @param createEventActionRequest * @return Result of the CreateEventAction operation returned by the service. * @throws ServiceLimitExceededException * The request has exceeded the quotas imposed by the service. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.CreateEventAction * @see AWS API Documentation */ @Override public CreateEventActionResponse createEventAction(CreateEventActionRequest createEventActionRequest) throws ServiceLimitExceededException, ThrottlingException, AccessDeniedException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateEventActionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createEventActionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createEventActionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateEventAction"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateEventAction").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createEventActionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateEventActionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation creates a job. *

* * @param createJobRequest * @return Result of the CreateJob operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ConflictException * The request couldn't be completed because it conflicted with the current state of the resource. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.CreateJob * @see AWS API * Documentation */ @Override public CreateJobResponse createJob(CreateJobRequest createJobRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ConflictException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateJob"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateJob").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(createJobRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateJobRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation creates a revision for a data set. *

* * @param createRevisionRequest * @return Result of the CreateRevision operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.CreateRevision * @see AWS * API Documentation */ @Override public CreateRevisionResponse createRevision(CreateRevisionRequest createRevisionRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateRevisionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createRevisionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createRevisionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateRevision"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateRevision").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createRevisionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateRevisionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation deletes an asset. *

* * @param deleteAssetRequest * @return Result of the DeleteAsset operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ConflictException * The request couldn't be completed because it conflicted with the current state of the resource. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.DeleteAsset * @see AWS API * Documentation */ @Override public DeleteAssetResponse deleteAsset(DeleteAssetRequest deleteAssetRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ConflictException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteAssetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAssetRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAssetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAsset"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteAsset").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(deleteAssetRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteAssetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation deletes a data set. *

* * @param deleteDataSetRequest * @return Result of the DeleteDataSet operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ConflictException * The request couldn't be completed because it conflicted with the current state of the resource. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.DeleteDataSet * @see AWS * API Documentation */ @Override public DeleteDataSetResponse deleteDataSet(DeleteDataSetRequest deleteDataSetRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ConflictException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteDataSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDataSetRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDataSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDataSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteDataSet").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteDataSetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteDataSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation deletes the event action. *

* * @param deleteEventActionRequest * @return Result of the DeleteEventAction operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.DeleteEventAction * @see AWS API Documentation */ @Override public DeleteEventActionResponse deleteEventAction(DeleteEventActionRequest deleteEventActionRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteEventActionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteEventActionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteEventActionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteEventAction"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteEventAction").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteEventActionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteEventActionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation deletes a revision. *

* * @param deleteRevisionRequest * @return Result of the DeleteRevision operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ConflictException * The request couldn't be completed because it conflicted with the current state of the resource. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.DeleteRevision * @see AWS * API Documentation */ @Override public DeleteRevisionResponse deleteRevision(DeleteRevisionRequest deleteRevisionRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ConflictException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteRevisionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteRevisionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRevisionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRevision"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteRevision").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteRevisionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteRevisionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation returns information about an asset. *

* * @param getAssetRequest * @return Result of the GetAsset operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.GetAsset * @see AWS API * Documentation */ @Override public GetAssetResponse getAsset(GetAssetRequest getAssetRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetAssetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getAssetRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getAssetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAsset"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetAsset").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(getAssetRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetAssetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation returns information about a data set. *

* * @param getDataSetRequest * @return Result of the GetDataSet operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.GetDataSet * @see AWS API * Documentation */ @Override public GetDataSetResponse getDataSet(GetDataSetRequest getDataSetRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetDataSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getDataSetRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getDataSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDataSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetDataSet").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(getDataSetRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetDataSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation retrieves information about an event action. *

* * @param getEventActionRequest * @return Result of the GetEventAction operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.GetEventAction * @see AWS * API Documentation */ @Override public GetEventActionResponse getEventAction(GetEventActionRequest getEventActionRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetEventActionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getEventActionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getEventActionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetEventAction"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetEventAction").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getEventActionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetEventActionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation returns information about a job. *

* * @param getJobRequest * @return Result of the GetJob operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.GetJob * @see AWS API * Documentation */ @Override public GetJobResponse getJob(GetJobRequest getJobRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetJob"); return clientHandler.execute(new ClientExecutionParams().withOperationName("GetJob") .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(getJobRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetJobRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation returns information about a revision. *

* * @param getRevisionRequest * @return Result of the GetRevision operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.GetRevision * @see AWS API * Documentation */ @Override public GetRevisionResponse getRevision(GetRevisionRequest getRevisionRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetRevisionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRevisionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRevisionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRevision"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetRevision").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(getRevisionRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetRevisionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation lists a data set's revisions sorted by CreatedAt in descending order. *

* * @param listDataSetRevisionsRequest * @return Result of the ListDataSetRevisions operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.ListDataSetRevisions * @see AWS API Documentation */ @Override public ListDataSetRevisionsResponse listDataSetRevisions(ListDataSetRevisionsRequest listDataSetRevisionsRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListDataSetRevisionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listDataSetRevisionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listDataSetRevisionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDataSetRevisions"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListDataSetRevisions").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listDataSetRevisionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListDataSetRevisionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation lists your data sets. When listing by origin OWNED, results are sorted by CreatedAt in descending * order. When listing by origin ENTITLED, there is no order and the maxResults parameter is ignored. *

* * @param listDataSetsRequest * @return Result of the ListDataSets operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.ListDataSets * @see AWS API * Documentation */ @Override public ListDataSetsResponse listDataSets(ListDataSetsRequest listDataSetsRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListDataSetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listDataSetsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listDataSetsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDataSets"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListDataSets").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listDataSetsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListDataSetsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation lists your event actions. *

* * @param listEventActionsRequest * @return Result of the ListEventActions operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.ListEventActions * @see AWS * API Documentation */ @Override public ListEventActionsResponse listEventActions(ListEventActionsRequest listEventActionsRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListEventActionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listEventActionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listEventActionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListEventActions"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListEventActions").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listEventActionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListEventActionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation lists your jobs sorted by CreatedAt in descending order. *

* * @param listJobsRequest * @return Result of the ListJobs operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.ListJobs * @see AWS API * Documentation */ @Override public ListJobsResponse listJobs(ListJobsRequest listJobsRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListJobsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listJobsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listJobsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListJobs"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListJobs").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(listJobsRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListJobsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation lists a revision's assets sorted alphabetically in descending order. *

* * @param listRevisionAssetsRequest * @return Result of the ListRevisionAssets operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.ListRevisionAssets * @see AWS API Documentation */ @Override public ListRevisionAssetsResponse listRevisionAssets(ListRevisionAssetsRequest listRevisionAssetsRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListRevisionAssetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listRevisionAssetsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listRevisionAssetsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRevisionAssets"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListRevisionAssets").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listRevisionAssetsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListRevisionAssetsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation lists the tags on the resource. *

* * @param listTagsForResourceRequest * @return Result of the ListTagsForResource operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.ListTagsForResource * @see AWS API Documentation */ @Override public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) throws AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listTagsForResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation revokes subscribers' access to a revision. *

* * @param revokeRevisionRequest * @return Result of the RevokeRevision operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ConflictException * The request couldn't be completed because it conflicted with the current state of the resource. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.RevokeRevision * @see AWS * API Documentation */ @Override public RevokeRevisionResponse revokeRevision(RevokeRevisionRequest revokeRevisionRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ConflictException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, RevokeRevisionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(revokeRevisionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, revokeRevisionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RevokeRevision"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("RevokeRevision").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(revokeRevisionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new RevokeRevisionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* The type of event associated with the data set. *

* * @param sendDataSetNotificationRequest * @return Result of the SendDataSetNotification operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ConflictException * The request couldn't be completed because it conflicted with the current state of the resource. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.SendDataSetNotification * @see AWS API Documentation */ @Override public SendDataSetNotificationResponse sendDataSetNotification(SendDataSetNotificationRequest sendDataSetNotificationRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ConflictException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, SendDataSetNotificationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(sendDataSetNotificationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, sendDataSetNotificationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SendDataSetNotification"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("SendDataSetNotification").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(sendDataSetNotificationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new SendDataSetNotificationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation starts a job. *

* * @param startJobRequest * @return Result of the StartJob operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ConflictException * The request couldn't be completed because it conflicted with the current state of the resource. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.StartJob * @see AWS API * Documentation */ @Override public StartJobResponse startJob(StartJobRequest startJobRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ConflictException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, StartJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartJob"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("StartJob").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(startJobRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new StartJobRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation tags a resource. *

* * @param tagResourceRequest * @return Result of the TagResource operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.TagResource * @see AWS API * Documentation */ @Override public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(tagResourceRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation removes one or more tags from a resource. *

* * @param untagResourceRequest * @return Result of the UntagResource operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.UntagResource * @see AWS * API Documentation */ @Override public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(untagResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation updates an asset. *

* * @param updateAssetRequest * @return Result of the UpdateAsset operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ConflictException * The request couldn't be completed because it conflicted with the current state of the resource. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.UpdateAsset * @see AWS API * Documentation */ @Override public UpdateAssetResponse updateAsset(UpdateAssetRequest updateAssetRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ConflictException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateAssetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateAssetRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateAssetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateAsset"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateAsset").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(updateAssetRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateAssetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation updates a data set. *

* * @param updateDataSetRequest * @return Result of the UpdateDataSet operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.UpdateDataSet * @see AWS * API Documentation */ @Override public UpdateDataSetResponse updateDataSet(UpdateDataSetRequest updateDataSetRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateDataSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateDataSetRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateDataSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateDataSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateDataSet").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateDataSetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateDataSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation updates the event action. *

* * @param updateEventActionRequest * @return Result of the UpdateEventAction operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.UpdateEventAction * @see AWS API Documentation */ @Override public UpdateEventActionResponse updateEventAction(UpdateEventActionRequest updateEventActionRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateEventActionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateEventActionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateEventActionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateEventAction"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateEventAction").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateEventActionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateEventActionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* This operation updates a revision. *

* * @param updateRevisionRequest * @return Result of the UpdateRevision operation returned by the service. * @throws ResourceNotFoundException * The resource couldn't be found. * @throws ThrottlingException * The limit on the number of requests per second was exceeded. * @throws AccessDeniedException * Access to the resource is denied. * @throws ConflictException * The request couldn't be completed because it conflicted with the current state of the resource. * @throws ValidationException * The request was invalid. * @throws InternalServerException * An exception occurred with the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws DataExchangeException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample DataExchangeClient.UpdateRevision * @see AWS * API Documentation */ @Override public UpdateRevisionResponse updateRevision(UpdateRevisionRequest updateRevisionRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, ConflictException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, DataExchangeException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateRevisionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateRevisionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateRevisionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DataExchange"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateRevision"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateRevision").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateRevisionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateRevisionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } @Override public final String serviceName() { return SERVICE_NAME; } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); if (retryMode != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode)); } else { Consumer> configurator = builder.retryStrategyConfigurator(); if (configurator != null) { RetryStrategy.Builder defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder(); configurator.accept(defaultBuilder); configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build()); } else { RetryStrategy retryStrategy = builder.retryStrategy(); if (retryStrategy != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy); } } } configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null); } private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) { List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList()); SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder(); if (plugins.isEmpty()) { return configuration.build(); } DataExchangeServiceClientConfigurationBuilder serviceConfigBuilder = new DataExchangeServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } updateRetryStrategyClientConfiguration(configuration); return configuration.build(); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(DataExchangeException::builder) .protocol(AwsJsonProtocol.REST_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("ThrottlingException") .exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerException") .exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(403).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ConflictException") .exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(409).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceLimitExceededException") .exceptionBuilderSupplier(ServiceLimitExceededException::builder).httpStatusCode(402).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build()); } @Override public final DataExchangeServiceClientConfiguration serviceClientConfiguration() { return new DataExchangeServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy