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

software.amazon.awssdk.services.sagemakergeospatial.DefaultSageMakerGeospatialAsyncClient Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.30.1
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.sagemakergeospatial;

import static software.amazon.awssdk.utils.FunctionalUtils.runAndLogError;

import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import java.util.function.Function;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
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.async.AsyncResponseTransformer;
import software.amazon.awssdk.core.async.AsyncResponseTransformerUtils;
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.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
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.sagemakergeospatial.internal.SageMakerGeospatialServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.sagemakergeospatial.model.AccessDeniedException;
import software.amazon.awssdk.services.sagemakergeospatial.model.ConflictException;
import software.amazon.awssdk.services.sagemakergeospatial.model.DeleteEarthObservationJobRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.DeleteEarthObservationJobResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.DeleteVectorEnrichmentJobRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.DeleteVectorEnrichmentJobResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.ExportEarthObservationJobRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.ExportEarthObservationJobResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.ExportVectorEnrichmentJobRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.ExportVectorEnrichmentJobResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.GetEarthObservationJobRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.GetEarthObservationJobResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.GetRasterDataCollectionRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.GetRasterDataCollectionResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.GetTileRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.GetTileResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.GetVectorEnrichmentJobRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.GetVectorEnrichmentJobResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.InternalServerException;
import software.amazon.awssdk.services.sagemakergeospatial.model.ListEarthObservationJobsRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.ListEarthObservationJobsResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.ListRasterDataCollectionsRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.ListRasterDataCollectionsResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.ListVectorEnrichmentJobsRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.ListVectorEnrichmentJobsResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.ResourceNotFoundException;
import software.amazon.awssdk.services.sagemakergeospatial.model.SageMakerGeospatialException;
import software.amazon.awssdk.services.sagemakergeospatial.model.SearchRasterDataCollectionRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.SearchRasterDataCollectionResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.sagemakergeospatial.model.StartEarthObservationJobRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.StartEarthObservationJobResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.StartVectorEnrichmentJobRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.StartVectorEnrichmentJobResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.StopEarthObservationJobRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.StopEarthObservationJobResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.StopVectorEnrichmentJobRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.StopVectorEnrichmentJobResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.TagResourceRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.TagResourceResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.ThrottlingException;
import software.amazon.awssdk.services.sagemakergeospatial.model.UntagResourceRequest;
import software.amazon.awssdk.services.sagemakergeospatial.model.UntagResourceResponse;
import software.amazon.awssdk.services.sagemakergeospatial.model.ValidationException;
import software.amazon.awssdk.services.sagemakergeospatial.transform.DeleteEarthObservationJobRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.DeleteVectorEnrichmentJobRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.ExportEarthObservationJobRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.ExportVectorEnrichmentJobRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.GetEarthObservationJobRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.GetRasterDataCollectionRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.GetTileRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.GetVectorEnrichmentJobRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.ListEarthObservationJobsRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.ListRasterDataCollectionsRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.ListVectorEnrichmentJobsRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.SearchRasterDataCollectionRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.StartEarthObservationJobRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.StartVectorEnrichmentJobRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.StopEarthObservationJobRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.StopVectorEnrichmentJobRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.sagemakergeospatial.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
import software.amazon.awssdk.utils.Pair;

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

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

    private final AsyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

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

    /**
     * 

* Use this operation to delete an Earth Observation job. *

* * @param deleteEarthObservationJobRequest * @return A Java Future containing the result of the DeleteEarthObservationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.DeleteEarthObservationJob * @see AWS API Documentation */ @Override public CompletableFuture deleteEarthObservationJob( DeleteEarthObservationJobRequest deleteEarthObservationJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteEarthObservationJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteEarthObservationJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteEarthObservationJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteEarthObservationJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteEarthObservationJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteEarthObservationJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteEarthObservationJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Use this operation to delete a Vector Enrichment job. *

* * @param deleteVectorEnrichmentJobRequest * @return A Java Future containing the result of the DeleteVectorEnrichmentJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.DeleteVectorEnrichmentJob * @see AWS API Documentation */ @Override public CompletableFuture deleteVectorEnrichmentJob( DeleteVectorEnrichmentJobRequest deleteVectorEnrichmentJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteVectorEnrichmentJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteVectorEnrichmentJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteVectorEnrichmentJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteVectorEnrichmentJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteVectorEnrichmentJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteVectorEnrichmentJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteVectorEnrichmentJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Use this operation to export results of an Earth Observation job and optionally source images used as input to * the EOJ to an Amazon S3 location. *

* * @param exportEarthObservationJobRequest * @return A Java Future containing the result of the ExportEarthObservationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ServiceQuotaExceededException You have exceeded the service quota.
  • *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.ExportEarthObservationJob * @see AWS API Documentation */ @Override public CompletableFuture exportEarthObservationJob( ExportEarthObservationJobRequest exportEarthObservationJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exportEarthObservationJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exportEarthObservationJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportEarthObservationJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ExportEarthObservationJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportEarthObservationJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new ExportEarthObservationJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(exportEarthObservationJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Use this operation to copy results of a Vector Enrichment job to an Amazon S3 location. *

* * @param exportVectorEnrichmentJobRequest * @return A Java Future containing the result of the ExportVectorEnrichmentJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ServiceQuotaExceededException You have exceeded the service quota.
  • *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.ExportVectorEnrichmentJob * @see AWS API Documentation */ @Override public CompletableFuture exportVectorEnrichmentJob( ExportVectorEnrichmentJobRequest exportVectorEnrichmentJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exportVectorEnrichmentJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exportVectorEnrichmentJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportVectorEnrichmentJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ExportVectorEnrichmentJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportVectorEnrichmentJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new ExportVectorEnrichmentJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(exportVectorEnrichmentJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Get the details for a previously initiated Earth Observation job. *

* * @param getEarthObservationJobRequest * @return A Java Future containing the result of the GetEarthObservationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.GetEarthObservationJob * @see AWS API Documentation */ @Override public CompletableFuture getEarthObservationJob( GetEarthObservationJobRequest getEarthObservationJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getEarthObservationJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getEarthObservationJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetEarthObservationJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetEarthObservationJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetEarthObservationJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetEarthObservationJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getEarthObservationJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Use this operation to get details of a specific raster data collection. *

* * @param getRasterDataCollectionRequest * @return A Java Future containing the result of the GetRasterDataCollection operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.GetRasterDataCollection * @see AWS API Documentation */ @Override public CompletableFuture getRasterDataCollection( GetRasterDataCollectionRequest getRasterDataCollectionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRasterDataCollectionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRasterDataCollectionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRasterDataCollection"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetRasterDataCollectionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetRasterDataCollection").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetRasterDataCollectionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getRasterDataCollectionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets a web mercator tile for the given Earth Observation job. *

* * @param getTileRequest * @param asyncResponseTransformer * The response transformer for processing the streaming response in a non-blocking manner. See * {@link AsyncResponseTransformer} for details on how this callback should be implemented and for links to * precanned implementations for common scenarios like downloading to a file. The service documentation for * the response content is as follows ' *

* The output binary file. *

* '. * @return A future to the transformed result of the AsyncResponseTransformer.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.GetTile * @see AWS * API Documentation */ @Override public CompletableFuture getTile(GetTileRequest getTileRequest, AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getTileRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getTileRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetTile"); Pair, CompletableFuture> pair = AsyncResponseTransformerUtils .wrapWithEndOfStreamFuture(asyncResponseTransformer); asyncResponseTransformer = pair.left(); CompletableFuture endOfStreamFuture = pair.right(); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true) .isPayloadJson(false).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetTileResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams().withOperationName("GetTile") .withProtocolMetadata(protocolMetadata).withMarshaller(new GetTileRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getTileRequest), asyncResponseTransformer); AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { if (e != null) { runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> finalAsyncResponseTransformer.exceptionOccurred(e)); } endOfStreamFuture.whenComplete((r2, e2) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { AsyncResponseTransformer finalAsyncResponseTransformer = asyncResponseTransformer; runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> finalAsyncResponseTransformer.exceptionOccurred(t)); metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Retrieves details of a Vector Enrichment Job for a given job Amazon Resource Name (ARN). *

* * @param getVectorEnrichmentJobRequest * @return A Java Future containing the result of the GetVectorEnrichmentJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.GetVectorEnrichmentJob * @see AWS API Documentation */ @Override public CompletableFuture getVectorEnrichmentJob( GetVectorEnrichmentJobRequest getVectorEnrichmentJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getVectorEnrichmentJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getVectorEnrichmentJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetVectorEnrichmentJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetVectorEnrichmentJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetVectorEnrichmentJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetVectorEnrichmentJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getVectorEnrichmentJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Use this operation to get a list of the Earth Observation jobs associated with the calling Amazon Web Services * account. *

* * @param listEarthObservationJobsRequest * @return A Java Future containing the result of the ListEarthObservationJobs operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.ListEarthObservationJobs * @see AWS API Documentation */ @Override public CompletableFuture listEarthObservationJobs( ListEarthObservationJobsRequest listEarthObservationJobsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listEarthObservationJobsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listEarthObservationJobsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListEarthObservationJobs"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListEarthObservationJobsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListEarthObservationJobs").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListEarthObservationJobsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listEarthObservationJobsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Use this operation to get raster data collections. *

* * @param listRasterDataCollectionsRequest * @return A Java Future containing the result of the ListRasterDataCollections operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.ListRasterDataCollections * @see AWS API Documentation */ @Override public CompletableFuture listRasterDataCollections( ListRasterDataCollectionsRequest listRasterDataCollectionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listRasterDataCollectionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listRasterDataCollectionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRasterDataCollections"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListRasterDataCollectionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListRasterDataCollections").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListRasterDataCollectionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listRasterDataCollectionsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists the tags attached to the resource. *

* * @param listTagsForResourceRequest * @return A Java Future containing the result of the ListTagsForResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.ListTagsForResource * @see AWS API Documentation */ @Override public CompletableFuture listTagsForResource( ListTagsForResourceRequest listTagsForResourceRequest) { 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, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listTagsForResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Retrieves a list of vector enrichment jobs. *

* * @param listVectorEnrichmentJobsRequest * @return A Java Future containing the result of the ListVectorEnrichmentJobs operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.ListVectorEnrichmentJobs * @see AWS API Documentation */ @Override public CompletableFuture listVectorEnrichmentJobs( ListVectorEnrichmentJobsRequest listVectorEnrichmentJobsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listVectorEnrichmentJobsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listVectorEnrichmentJobsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListVectorEnrichmentJobs"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListVectorEnrichmentJobsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListVectorEnrichmentJobs").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListVectorEnrichmentJobsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listVectorEnrichmentJobsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Allows you run image query on a specific raster data collection to get a list of the satellite imagery matching * the selected filters. *

* * @param searchRasterDataCollectionRequest * @return A Java Future containing the result of the SearchRasterDataCollection operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.SearchRasterDataCollection * @see AWS API Documentation */ @Override public CompletableFuture searchRasterDataCollection( SearchRasterDataCollectionRequest searchRasterDataCollectionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(searchRasterDataCollectionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, searchRasterDataCollectionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SearchRasterDataCollection"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, SearchRasterDataCollectionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("SearchRasterDataCollection").withProtocolMetadata(protocolMetadata) .withMarshaller(new SearchRasterDataCollectionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(searchRasterDataCollectionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Use this operation to create an Earth observation job. *

* * @param startEarthObservationJobRequest * @return A Java Future containing the result of the StartEarthObservationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ServiceQuotaExceededException You have exceeded the service quota.
  • *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.StartEarthObservationJob * @see AWS API Documentation */ @Override public CompletableFuture startEarthObservationJob( StartEarthObservationJobRequest startEarthObservationJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startEarthObservationJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startEarthObservationJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartEarthObservationJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartEarthObservationJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StartEarthObservationJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new StartEarthObservationJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(startEarthObservationJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates a Vector Enrichment job for the supplied job type. Currently, there are two supported job types: reverse * geocoding and map matching. *

* * @param startVectorEnrichmentJobRequest * @return A Java Future containing the result of the StartVectorEnrichmentJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ServiceQuotaExceededException You have exceeded the service quota.
  • *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.StartVectorEnrichmentJob * @see AWS API Documentation */ @Override public CompletableFuture startVectorEnrichmentJob( StartVectorEnrichmentJobRequest startVectorEnrichmentJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startVectorEnrichmentJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startVectorEnrichmentJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartVectorEnrichmentJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartVectorEnrichmentJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StartVectorEnrichmentJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new StartVectorEnrichmentJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(startVectorEnrichmentJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Use this operation to stop an existing earth observation job. *

* * @param stopEarthObservationJobRequest * @return A Java Future containing the result of the StopEarthObservationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.StopEarthObservationJob * @see AWS API Documentation */ @Override public CompletableFuture stopEarthObservationJob( StopEarthObservationJobRequest stopEarthObservationJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(stopEarthObservationJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, stopEarthObservationJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StopEarthObservationJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StopEarthObservationJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StopEarthObservationJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new StopEarthObservationJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(stopEarthObservationJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Stops the Vector Enrichment job for a given job ARN. *

* * @param stopVectorEnrichmentJobRequest * @return A Java Future containing the result of the StopVectorEnrichmentJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.StopVectorEnrichmentJob * @see AWS API Documentation */ @Override public CompletableFuture stopVectorEnrichmentJob( StopVectorEnrichmentJobRequest stopVectorEnrichmentJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(stopVectorEnrichmentJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, stopVectorEnrichmentJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StopVectorEnrichmentJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StopVectorEnrichmentJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StopVectorEnrichmentJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new StopVectorEnrichmentJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(stopVectorEnrichmentJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* The resource you want to tag. *

* * @param tagResourceRequest * @return A Java Future containing the result of the TagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.TagResource * @see AWS API Documentation */ @Override public CompletableFuture tagResource(TagResourceRequest tagResourceRequest) { 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, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(tagResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* The resource you want to untag. *

* * @param untagResourceRequest * @return A Java Future containing the result of the UntagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • AccessDeniedException You do not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints specified by an Amazon Web Services * service.
  • *
  • ThrottlingException The request was denied due to request throttling.
  • *
  • InternalServerException The request processing has failed because of an unknown error, exception, or * failure.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SageMakerGeospatialException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample SageMakerGeospatialAsyncClient.UntagResource * @see AWS API Documentation */ @Override public CompletableFuture untagResource(UntagResourceRequest untagResourceRequest) { 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, "SageMaker Geospatial"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(untagResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } @Override public final SageMakerGeospatialServiceClientConfiguration serviceClientConfiguration() { return new SageMakerGeospatialServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public final String serviceName() { return SERVICE_NAME; } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(SageMakerGeospatialException::builder) .protocol(AwsJsonProtocol.REST_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("ThrottlingException") .exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceQuotaExceededException") .exceptionBuilderSupplier(ServiceQuotaExceededException::builder).httpStatusCode(402).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("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build()); } 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 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(); } SageMakerGeospatialServiceClientConfigurationBuilder serviceConfigBuilder = new SageMakerGeospatialServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } updateRetryStrategyClientConfiguration(configuration); return configuration.build(); } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy