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

software.amazon.awssdk.services.medicalimaging.DefaultMedicalImagingAsyncClient Maven / Gradle / Ivy

Go to download

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

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

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

import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
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.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.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.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.services.medicalimaging.internal.MedicalImagingServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.medicalimaging.model.AccessDeniedException;
import software.amazon.awssdk.services.medicalimaging.model.ConflictException;
import software.amazon.awssdk.services.medicalimaging.model.CopyImageSetRequest;
import software.amazon.awssdk.services.medicalimaging.model.CopyImageSetResponse;
import software.amazon.awssdk.services.medicalimaging.model.CreateDatastoreRequest;
import software.amazon.awssdk.services.medicalimaging.model.CreateDatastoreResponse;
import software.amazon.awssdk.services.medicalimaging.model.DeleteDatastoreRequest;
import software.amazon.awssdk.services.medicalimaging.model.DeleteDatastoreResponse;
import software.amazon.awssdk.services.medicalimaging.model.DeleteImageSetRequest;
import software.amazon.awssdk.services.medicalimaging.model.DeleteImageSetResponse;
import software.amazon.awssdk.services.medicalimaging.model.GetDatastoreRequest;
import software.amazon.awssdk.services.medicalimaging.model.GetDatastoreResponse;
import software.amazon.awssdk.services.medicalimaging.model.GetDicomImportJobRequest;
import software.amazon.awssdk.services.medicalimaging.model.GetDicomImportJobResponse;
import software.amazon.awssdk.services.medicalimaging.model.GetImageFrameRequest;
import software.amazon.awssdk.services.medicalimaging.model.GetImageFrameResponse;
import software.amazon.awssdk.services.medicalimaging.model.GetImageSetMetadataRequest;
import software.amazon.awssdk.services.medicalimaging.model.GetImageSetMetadataResponse;
import software.amazon.awssdk.services.medicalimaging.model.GetImageSetRequest;
import software.amazon.awssdk.services.medicalimaging.model.GetImageSetResponse;
import software.amazon.awssdk.services.medicalimaging.model.InternalServerException;
import software.amazon.awssdk.services.medicalimaging.model.ListDatastoresRequest;
import software.amazon.awssdk.services.medicalimaging.model.ListDatastoresResponse;
import software.amazon.awssdk.services.medicalimaging.model.ListDicomImportJobsRequest;
import software.amazon.awssdk.services.medicalimaging.model.ListDicomImportJobsResponse;
import software.amazon.awssdk.services.medicalimaging.model.ListImageSetVersionsRequest;
import software.amazon.awssdk.services.medicalimaging.model.ListImageSetVersionsResponse;
import software.amazon.awssdk.services.medicalimaging.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.medicalimaging.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.medicalimaging.model.MedicalImagingException;
import software.amazon.awssdk.services.medicalimaging.model.ResourceNotFoundException;
import software.amazon.awssdk.services.medicalimaging.model.SearchImageSetsRequest;
import software.amazon.awssdk.services.medicalimaging.model.SearchImageSetsResponse;
import software.amazon.awssdk.services.medicalimaging.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.medicalimaging.model.StartDicomImportJobRequest;
import software.amazon.awssdk.services.medicalimaging.model.StartDicomImportJobResponse;
import software.amazon.awssdk.services.medicalimaging.model.TagResourceRequest;
import software.amazon.awssdk.services.medicalimaging.model.TagResourceResponse;
import software.amazon.awssdk.services.medicalimaging.model.ThrottlingException;
import software.amazon.awssdk.services.medicalimaging.model.UntagResourceRequest;
import software.amazon.awssdk.services.medicalimaging.model.UntagResourceResponse;
import software.amazon.awssdk.services.medicalimaging.model.UpdateImageSetMetadataRequest;
import software.amazon.awssdk.services.medicalimaging.model.UpdateImageSetMetadataResponse;
import software.amazon.awssdk.services.medicalimaging.model.ValidationException;
import software.amazon.awssdk.services.medicalimaging.transform.CopyImageSetRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.CreateDatastoreRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.DeleteDatastoreRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.DeleteImageSetRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.GetDatastoreRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.GetDicomImportJobRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.GetImageFrameRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.GetImageSetMetadataRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.GetImageSetRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.ListDatastoresRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.ListDicomImportJobsRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.ListImageSetVersionsRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.SearchImageSetsRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.StartDicomImportJobRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.medicalimaging.transform.UpdateImageSetMetadataRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
import software.amazon.awssdk.utils.Pair;

/**
 * Internal implementation of {@link MedicalImagingAsyncClient}.
 *
 * @see MedicalImagingAsyncClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultMedicalImagingAsyncClient implements MedicalImagingAsyncClient {
    private static final Logger log = LoggerFactory.getLogger(DefaultMedicalImagingAsyncClient.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 DefaultMedicalImagingAsyncClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Copy an image set. *

* * @param copyImageSetRequest * @return A Java Future containing the result of the CopyImageSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ServiceQuotaExceededException The request caused a service quota to be exceeded.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.CopyImageSet * @see AWS * API Documentation */ @Override public CompletableFuture copyImageSet(CopyImageSetRequest copyImageSetRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(copyImageSetRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, copyImageSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CopyImageSet"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CopyImageSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); String hostPrefix = "runtime-"; String resolvedHostExpression = "runtime-"; CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CopyImageSet").withProtocolMetadata(protocolMetadata) .withMarshaller(new CopyImageSetRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .hostPrefixExpression(resolvedHostExpression).withInput(copyImageSetRequest)); 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); } } /** *

* Create a data store. *

* * @param createDatastoreRequest * @return A Java Future containing the result of the CreateDatastore operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • ServiceQuotaExceededException The request caused a service quota to be exceeded.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.CreateDatastore * @see AWS API Documentation */ @Override public CompletableFuture createDatastore(CreateDatastoreRequest createDatastoreRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createDatastoreRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createDatastoreRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDatastore"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateDatastoreResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateDatastore").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateDatastoreRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createDatastoreRequest)); 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); } } /** *

* Delete a data store. *

* *

* Before a data store can be deleted, you must first delete all image sets within it. *

*
* * @param deleteDatastoreRequest * @return A Java Future containing the result of the DeleteDatastore operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.DeleteDatastore * @see AWS API Documentation */ @Override public CompletableFuture deleteDatastore(DeleteDatastoreRequest deleteDatastoreRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDatastoreRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDatastoreRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDatastore"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteDatastoreResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteDatastore").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteDatastoreRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteDatastoreRequest)); 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); } } /** *

* Delete an image set. *

* * @param deleteImageSetRequest * @return A Java Future containing the result of the DeleteImageSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.DeleteImageSet * @see AWS API Documentation */ @Override public CompletableFuture deleteImageSet(DeleteImageSetRequest deleteImageSetRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteImageSetRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteImageSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteImageSet"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteImageSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); String hostPrefix = "runtime-"; String resolvedHostExpression = "runtime-"; CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteImageSet").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteImageSetRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .hostPrefixExpression(resolvedHostExpression).withInput(deleteImageSetRequest)); 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 import job properties to learn more about the job or job progress. *

* * @param getDicomImportJobRequest * @return A Java Future containing the result of the GetDICOMImportJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.GetDICOMImportJob * @see AWS API Documentation */ @Override public CompletableFuture getDICOMImportJob(GetDicomImportJobRequest getDicomImportJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getDicomImportJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getDicomImportJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDICOMImportJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetDicomImportJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetDICOMImportJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetDicomImportJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getDicomImportJobRequest)); 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 data store properties. *

* * @param getDatastoreRequest * @return A Java Future containing the result of the GetDatastore operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.GetDatastore * @see AWS * API Documentation */ @Override public CompletableFuture getDatastore(GetDatastoreRequest getDatastoreRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getDatastoreRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getDatastoreRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDatastore"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetDatastoreResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetDatastore").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetDatastoreRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getDatastoreRequest)); 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 an image frame (pixel data) for an image set. *

* * @param getImageFrameRequest * @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 blob containing the aggregated image frame information. *

* '. * @return A future to the transformed result of the AsyncResponseTransformer.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.GetImageFrame * @see AWS * API Documentation */ @Override public CompletableFuture getImageFrame(GetImageFrameRequest getImageFrameRequest, AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getImageFrameRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getImageFrameRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetImageFrame"); 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, GetImageFrameResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); String hostPrefix = "runtime-"; String resolvedHostExpression = "runtime-"; CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams().withOperationName("GetImageFrame") .withProtocolMetadata(protocolMetadata) .withMarshaller(new GetImageFrameRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .hostPrefixExpression(resolvedHostExpression).withInput(getImageFrameRequest), 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); } } /** *

* Get image set properties. *

* * @param getImageSetRequest * @return A Java Future containing the result of the GetImageSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.GetImageSet * @see AWS * API Documentation */ @Override public CompletableFuture getImageSet(GetImageSetRequest getImageSetRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getImageSetRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getImageSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetImageSet"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetImageSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); String hostPrefix = "runtime-"; String resolvedHostExpression = "runtime-"; CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetImageSet").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetImageSetRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .hostPrefixExpression(resolvedHostExpression).withInput(getImageSetRequest)); 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 metadata attributes for an image set. *

* * @param getImageSetMetadataRequest * @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 blob containing the aggregated metadata information for the image set. *

* '. * @return A future to the transformed result of the AsyncResponseTransformer.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.GetImageSetMetadata * @see AWS API Documentation */ @Override public CompletableFuture getImageSetMetadata(GetImageSetMetadataRequest getImageSetMetadataRequest, AsyncResponseTransformer asyncResponseTransformer) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getImageSetMetadataRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getImageSetMetadataRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetImageSetMetadata"); 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, GetImageSetMetadataResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); String hostPrefix = "runtime-"; String resolvedHostExpression = "runtime-"; CompletableFuture executeFuture = clientHandler.execute( new ClientExecutionParams() .withOperationName("GetImageSetMetadata").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetImageSetMetadataRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .hostPrefixExpression(resolvedHostExpression).withInput(getImageSetMetadataRequest), 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); } } /** *

* List import jobs created for a specific data store. *

* * @param listDicomImportJobsRequest * @return A Java Future containing the result of the ListDICOMImportJobs operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.ListDICOMImportJobs * @see AWS API Documentation */ @Override public CompletableFuture listDICOMImportJobs( ListDicomImportJobsRequest listDicomImportJobsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listDicomImportJobsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listDicomImportJobsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDICOMImportJobs"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListDicomImportJobsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListDICOMImportJobs").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListDicomImportJobsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listDicomImportJobsRequest)); 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); } } /** *

* List data stores. *

* * @param listDatastoresRequest * @return A Java Future containing the result of the ListDatastores operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.ListDatastores * @see AWS API Documentation */ @Override public CompletableFuture listDatastores(ListDatastoresRequest listDatastoresRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listDatastoresRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listDatastoresRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDatastores"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListDatastoresResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListDatastores").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListDatastoresRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listDatastoresRequest)); 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); } } /** *

* List image set versions. *

* * @param listImageSetVersionsRequest * @return A Java Future containing the result of the ListImageSetVersions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.ListImageSetVersions * @see AWS API Documentation */ @Override public CompletableFuture listImageSetVersions( ListImageSetVersionsRequest listImageSetVersionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listImageSetVersionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listImageSetVersionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListImageSetVersions"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListImageSetVersionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); String hostPrefix = "runtime-"; String resolvedHostExpression = "runtime-"; CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListImageSetVersions").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListImageSetVersionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .hostPrefixExpression(resolvedHostExpression).withInput(listImageSetVersionsRequest)); 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 all tags associated with a medical imaging 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. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.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, "Medical Imaging"); 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); } } /** *

* Search image sets based on defined input attributes. *

* *

* SearchImageSets accepts a single search query parameter and returns a paginated response of all * image sets that have the matching criteria. All range queries must be input as * (lowerBound, upperBound). *

*

* SearchImageSets uses the updatedAt field for sorting in decreasing order from latest to * oldest. *

*
* * @param searchImageSetsRequest * @return A Java Future containing the result of the SearchImageSets operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.SearchImageSets * @see AWS API Documentation */ @Override public CompletableFuture searchImageSets(SearchImageSetsRequest searchImageSetsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(searchImageSetsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, searchImageSetsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SearchImageSets"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, SearchImageSetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); String hostPrefix = "runtime-"; String resolvedHostExpression = "runtime-"; CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("SearchImageSets").withProtocolMetadata(protocolMetadata) .withMarshaller(new SearchImageSetsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .hostPrefixExpression(resolvedHostExpression).withInput(searchImageSetsRequest)); 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); } } /** *

* Start importing bulk data into an ACTIVE data store. The import job imports DICOM P10 files found in * the S3 prefix specified by the inputS3Uri parameter. The import job stores processing results in the * file specified by the outputS3Uri parameter. *

* * @param startDicomImportJobRequest * @return A Java Future containing the result of the StartDICOMImportJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ServiceQuotaExceededException The request caused a service quota to be exceeded.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.StartDICOMImportJob * @see AWS API Documentation */ @Override public CompletableFuture startDICOMImportJob( StartDicomImportJobRequest startDicomImportJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startDicomImportJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startDicomImportJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartDICOMImportJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartDicomImportJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StartDICOMImportJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new StartDicomImportJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(startDicomImportJobRequest)); 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); } } /** *

* Adds a user-specifed key and value tag to a medical imaging resource. *

* * @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. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.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, "Medical Imaging"); 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); } } /** *

* Removes tags from a medical imaging resource. *

* * @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. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.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, "Medical Imaging"); 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); } } /** *

* Update image set metadata attributes. *

* * @param updateImageSetMetadataRequest * @return A Java Future containing the result of the UpdateImageSetMetadata operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied due to throttling.
  • *
  • ConflictException Updating or deleting a resource can cause an inconsistent state.
  • *
  • AccessDeniedException The user does not have sufficient access to perform this action.
  • *
  • ValidationException The input fails to satisfy the constraints set by the service.
  • *
  • InternalServerException An unexpected error occurred during processing of the request.
  • *
  • ResourceNotFoundException The request references a resource which does not exist.
  • *
  • ServiceQuotaExceededException The request caused a service quota to be exceeded.
  • *
  • 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.
  • *
  • MedicalImagingException Base class for all service exceptions. Unknown exceptions will be thrown as * an instance of this type.
  • *
* @sample MedicalImagingAsyncClient.UpdateImageSetMetadata * @see AWS API Documentation */ @Override public CompletableFuture updateImageSetMetadata( UpdateImageSetMetadataRequest updateImageSetMetadataRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateImageSetMetadataRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateImageSetMetadataRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Medical Imaging"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateImageSetMetadata"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateImageSetMetadataResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); String hostPrefix = "runtime-"; String resolvedHostExpression = "runtime-"; CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateImageSetMetadata").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateImageSetMetadataRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .hostPrefixExpression(resolvedHostExpression).withInput(updateImageSetMetadataRequest)); 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 MedicalImagingServiceClientConfiguration serviceClientConfiguration() { return new MedicalImagingServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public final String serviceName() { return SERVICE_NAME; } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(MedicalImagingException::builder) .protocol(AwsJsonProtocol.REST_JSON) .protocolVersion("1.1") .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("ThrottlingException") .exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceQuotaExceededException") .exceptionBuilderSupplier(ServiceQuotaExceededException::builder).httpStatusCode(402).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerException") .exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).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 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(); } MedicalImagingServiceClientConfigurationBuilder serviceConfigBuilder = new MedicalImagingServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } return configuration.build(); } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy