
software.amazon.awssdk.services.imagebuilder.DefaultImagebuilderAsyncClient Maven / Gradle / Ivy
/*
* 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.imagebuilder;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
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.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
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.util.VersionInfo;
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.imagebuilder.model.CallRateLimitExceededException;
import software.amazon.awssdk.services.imagebuilder.model.CancelImageCreationRequest;
import software.amazon.awssdk.services.imagebuilder.model.CancelImageCreationResponse;
import software.amazon.awssdk.services.imagebuilder.model.ClientException;
import software.amazon.awssdk.services.imagebuilder.model.CreateComponentRequest;
import software.amazon.awssdk.services.imagebuilder.model.CreateComponentResponse;
import software.amazon.awssdk.services.imagebuilder.model.CreateContainerRecipeRequest;
import software.amazon.awssdk.services.imagebuilder.model.CreateContainerRecipeResponse;
import software.amazon.awssdk.services.imagebuilder.model.CreateDistributionConfigurationRequest;
import software.amazon.awssdk.services.imagebuilder.model.CreateDistributionConfigurationResponse;
import software.amazon.awssdk.services.imagebuilder.model.CreateImagePipelineRequest;
import software.amazon.awssdk.services.imagebuilder.model.CreateImagePipelineResponse;
import software.amazon.awssdk.services.imagebuilder.model.CreateImageRecipeRequest;
import software.amazon.awssdk.services.imagebuilder.model.CreateImageRecipeResponse;
import software.amazon.awssdk.services.imagebuilder.model.CreateImageRequest;
import software.amazon.awssdk.services.imagebuilder.model.CreateImageResponse;
import software.amazon.awssdk.services.imagebuilder.model.CreateInfrastructureConfigurationRequest;
import software.amazon.awssdk.services.imagebuilder.model.CreateInfrastructureConfigurationResponse;
import software.amazon.awssdk.services.imagebuilder.model.DeleteComponentRequest;
import software.amazon.awssdk.services.imagebuilder.model.DeleteComponentResponse;
import software.amazon.awssdk.services.imagebuilder.model.DeleteContainerRecipeRequest;
import software.amazon.awssdk.services.imagebuilder.model.DeleteContainerRecipeResponse;
import software.amazon.awssdk.services.imagebuilder.model.DeleteDistributionConfigurationRequest;
import software.amazon.awssdk.services.imagebuilder.model.DeleteDistributionConfigurationResponse;
import software.amazon.awssdk.services.imagebuilder.model.DeleteImagePipelineRequest;
import software.amazon.awssdk.services.imagebuilder.model.DeleteImagePipelineResponse;
import software.amazon.awssdk.services.imagebuilder.model.DeleteImageRecipeRequest;
import software.amazon.awssdk.services.imagebuilder.model.DeleteImageRecipeResponse;
import software.amazon.awssdk.services.imagebuilder.model.DeleteImageRequest;
import software.amazon.awssdk.services.imagebuilder.model.DeleteImageResponse;
import software.amazon.awssdk.services.imagebuilder.model.DeleteInfrastructureConfigurationRequest;
import software.amazon.awssdk.services.imagebuilder.model.DeleteInfrastructureConfigurationResponse;
import software.amazon.awssdk.services.imagebuilder.model.ForbiddenException;
import software.amazon.awssdk.services.imagebuilder.model.GetComponentPolicyRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetComponentPolicyResponse;
import software.amazon.awssdk.services.imagebuilder.model.GetComponentRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetComponentResponse;
import software.amazon.awssdk.services.imagebuilder.model.GetContainerRecipePolicyRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetContainerRecipePolicyResponse;
import software.amazon.awssdk.services.imagebuilder.model.GetContainerRecipeRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetContainerRecipeResponse;
import software.amazon.awssdk.services.imagebuilder.model.GetDistributionConfigurationRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetDistributionConfigurationResponse;
import software.amazon.awssdk.services.imagebuilder.model.GetImagePipelineRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetImagePipelineResponse;
import software.amazon.awssdk.services.imagebuilder.model.GetImagePolicyRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetImagePolicyResponse;
import software.amazon.awssdk.services.imagebuilder.model.GetImageRecipePolicyRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetImageRecipePolicyResponse;
import software.amazon.awssdk.services.imagebuilder.model.GetImageRecipeRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetImageRecipeResponse;
import software.amazon.awssdk.services.imagebuilder.model.GetImageRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetImageResponse;
import software.amazon.awssdk.services.imagebuilder.model.GetInfrastructureConfigurationRequest;
import software.amazon.awssdk.services.imagebuilder.model.GetInfrastructureConfigurationResponse;
import software.amazon.awssdk.services.imagebuilder.model.IdempotentParameterMismatchException;
import software.amazon.awssdk.services.imagebuilder.model.ImagebuilderException;
import software.amazon.awssdk.services.imagebuilder.model.ImagebuilderRequest;
import software.amazon.awssdk.services.imagebuilder.model.ImportComponentRequest;
import software.amazon.awssdk.services.imagebuilder.model.ImportComponentResponse;
import software.amazon.awssdk.services.imagebuilder.model.ImportVmImageRequest;
import software.amazon.awssdk.services.imagebuilder.model.ImportVmImageResponse;
import software.amazon.awssdk.services.imagebuilder.model.InvalidPaginationTokenException;
import software.amazon.awssdk.services.imagebuilder.model.InvalidParameterCombinationException;
import software.amazon.awssdk.services.imagebuilder.model.InvalidParameterException;
import software.amazon.awssdk.services.imagebuilder.model.InvalidParameterValueException;
import software.amazon.awssdk.services.imagebuilder.model.InvalidRequestException;
import software.amazon.awssdk.services.imagebuilder.model.InvalidVersionNumberException;
import software.amazon.awssdk.services.imagebuilder.model.ListComponentBuildVersionsRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListComponentBuildVersionsResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListComponentsRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListComponentsResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListContainerRecipesRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListContainerRecipesResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListDistributionConfigurationsRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListDistributionConfigurationsResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListImageBuildVersionsRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListImageBuildVersionsResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListImagePackagesRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListImagePackagesResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListImagePipelineImagesRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListImagePipelineImagesResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListImagePipelinesRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListImagePipelinesResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListImageRecipesRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListImageRecipesResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListImagesRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListImagesResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListInfrastructureConfigurationsRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListInfrastructureConfigurationsResponse;
import software.amazon.awssdk.services.imagebuilder.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.imagebuilder.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.imagebuilder.model.PutComponentPolicyRequest;
import software.amazon.awssdk.services.imagebuilder.model.PutComponentPolicyResponse;
import software.amazon.awssdk.services.imagebuilder.model.PutContainerRecipePolicyRequest;
import software.amazon.awssdk.services.imagebuilder.model.PutContainerRecipePolicyResponse;
import software.amazon.awssdk.services.imagebuilder.model.PutImagePolicyRequest;
import software.amazon.awssdk.services.imagebuilder.model.PutImagePolicyResponse;
import software.amazon.awssdk.services.imagebuilder.model.PutImageRecipePolicyRequest;
import software.amazon.awssdk.services.imagebuilder.model.PutImageRecipePolicyResponse;
import software.amazon.awssdk.services.imagebuilder.model.ResourceAlreadyExistsException;
import software.amazon.awssdk.services.imagebuilder.model.ResourceDependencyException;
import software.amazon.awssdk.services.imagebuilder.model.ResourceInUseException;
import software.amazon.awssdk.services.imagebuilder.model.ResourceNotFoundException;
import software.amazon.awssdk.services.imagebuilder.model.ServiceException;
import software.amazon.awssdk.services.imagebuilder.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.imagebuilder.model.ServiceUnavailableException;
import software.amazon.awssdk.services.imagebuilder.model.StartImagePipelineExecutionRequest;
import software.amazon.awssdk.services.imagebuilder.model.StartImagePipelineExecutionResponse;
import software.amazon.awssdk.services.imagebuilder.model.TagResourceRequest;
import software.amazon.awssdk.services.imagebuilder.model.TagResourceResponse;
import software.amazon.awssdk.services.imagebuilder.model.UntagResourceRequest;
import software.amazon.awssdk.services.imagebuilder.model.UntagResourceResponse;
import software.amazon.awssdk.services.imagebuilder.model.UpdateDistributionConfigurationRequest;
import software.amazon.awssdk.services.imagebuilder.model.UpdateDistributionConfigurationResponse;
import software.amazon.awssdk.services.imagebuilder.model.UpdateImagePipelineRequest;
import software.amazon.awssdk.services.imagebuilder.model.UpdateImagePipelineResponse;
import software.amazon.awssdk.services.imagebuilder.model.UpdateInfrastructureConfigurationRequest;
import software.amazon.awssdk.services.imagebuilder.model.UpdateInfrastructureConfigurationResponse;
import software.amazon.awssdk.services.imagebuilder.paginators.ListComponentBuildVersionsPublisher;
import software.amazon.awssdk.services.imagebuilder.paginators.ListComponentsPublisher;
import software.amazon.awssdk.services.imagebuilder.paginators.ListContainerRecipesPublisher;
import software.amazon.awssdk.services.imagebuilder.paginators.ListDistributionConfigurationsPublisher;
import software.amazon.awssdk.services.imagebuilder.paginators.ListImageBuildVersionsPublisher;
import software.amazon.awssdk.services.imagebuilder.paginators.ListImagePackagesPublisher;
import software.amazon.awssdk.services.imagebuilder.paginators.ListImagePipelineImagesPublisher;
import software.amazon.awssdk.services.imagebuilder.paginators.ListImagePipelinesPublisher;
import software.amazon.awssdk.services.imagebuilder.paginators.ListImageRecipesPublisher;
import software.amazon.awssdk.services.imagebuilder.paginators.ListImagesPublisher;
import software.amazon.awssdk.services.imagebuilder.paginators.ListInfrastructureConfigurationsPublisher;
import software.amazon.awssdk.services.imagebuilder.transform.CancelImageCreationRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.CreateComponentRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.CreateContainerRecipeRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.CreateDistributionConfigurationRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.CreateImagePipelineRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.CreateImageRecipeRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.CreateImageRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.CreateInfrastructureConfigurationRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.DeleteComponentRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.DeleteContainerRecipeRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.DeleteDistributionConfigurationRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.DeleteImagePipelineRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.DeleteImageRecipeRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.DeleteImageRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.DeleteInfrastructureConfigurationRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetComponentPolicyRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetComponentRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetContainerRecipePolicyRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetContainerRecipeRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetDistributionConfigurationRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetImagePipelineRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetImagePolicyRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetImageRecipePolicyRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetImageRecipeRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetImageRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.GetInfrastructureConfigurationRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ImportComponentRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ImportVmImageRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListComponentBuildVersionsRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListComponentsRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListContainerRecipesRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListDistributionConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListImageBuildVersionsRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListImagePackagesRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListImagePipelineImagesRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListImagePipelinesRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListImageRecipesRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListImagesRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListInfrastructureConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.PutComponentPolicyRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.PutContainerRecipePolicyRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.PutImagePolicyRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.PutImageRecipePolicyRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.StartImagePipelineExecutionRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.UpdateDistributionConfigurationRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.UpdateImagePipelineRequestMarshaller;
import software.amazon.awssdk.services.imagebuilder.transform.UpdateInfrastructureConfigurationRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link ImagebuilderAsyncClient}.
*
* @see ImagebuilderAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultImagebuilderAsyncClient implements ImagebuilderAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultImagebuilderAsyncClient.class);
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultImagebuilderAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* CancelImageCreation cancels the creation of Image. This operation can only be used on images in a non-terminal
* state.
*
*
* @param cancelImageCreationRequest
* @return A Java Future containing the result of the CancelImageCreation operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - IdempotentParameterMismatchException You have specified a client token for an operation using
* parameter values that differ from a previous request that used the same client token.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceInUseException The resource that you are trying to operate on is currently in use. Review the
* message details and retry later.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.CancelImageCreation
* @see AWS API Documentation
*/
@Override
public CompletableFuture cancelImageCreation(
CancelImageCreationRequest cancelImageCreationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelImageCreationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelImageCreation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CancelImageCreationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CancelImageCreation")
.withMarshaller(new CancelImageCreationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(cancelImageCreationRequest));
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 new component that can be used to build, validate, test, and assess your image. The component is based
* on a YAML document that you specify using exactly one of the following methods:
*
*
* -
*
* Inline, using the data
property in the request body.
*
*
* -
*
* A URL that points to a YAML document file stored in Amazon S3, using the uri
property in the request
* body.
*
*
*
*
* @param createComponentRequest
* @return A Java Future containing the result of the CreateComponent operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - IdempotentParameterMismatchException You have specified a client token for an operation using
* parameter values that differ from a previous request that used the same client token.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - InvalidVersionNumberException Your version number is out of bounds or does not follow the required
* syntax.
* - ResourceInUseException The resource that you are trying to operate on is currently in use. Review the
* message details and retry later.
* - InvalidParameterCombinationException You have specified two or more mutually exclusive parameters.
* Review the error message for details.
* - ServiceQuotaExceededException You have exceeded the number of permitted resources or operations for
* this service. For service quotas, see EC2 Image
* Builder endpoints and quotas.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.CreateComponent
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createComponent(CreateComponentRequest createComponentRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createComponentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateComponent");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateComponentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateComponent")
.withMarshaller(new CreateComponentRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createComponentRequest));
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 new container recipe. Container recipes define how images are configured, tested, and assessed.
*
*
* @param createContainerRecipeRequest
* @return A Java Future containing the result of the CreateContainerRecipe operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - IdempotentParameterMismatchException You have specified a client token for an operation using
* parameter values that differ from a previous request that used the same client token.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - InvalidVersionNumberException Your version number is out of bounds or does not follow the required
* syntax.
* - ResourceInUseException The resource that you are trying to operate on is currently in use. Review the
* message details and retry later.
* - ResourceAlreadyExistsException The resource that you are trying to create already exists.
* - ServiceQuotaExceededException You have exceeded the number of permitted resources or operations for
* this service. For service quotas, see EC2 Image
* Builder endpoints and quotas.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.CreateContainerRecipe
* @see AWS API Documentation
*/
@Override
public CompletableFuture createContainerRecipe(
CreateContainerRecipeRequest createContainerRecipeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createContainerRecipeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateContainerRecipe");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateContainerRecipeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateContainerRecipe")
.withMarshaller(new CreateContainerRecipeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createContainerRecipeRequest));
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 new distribution configuration. Distribution configurations define and configure the outputs of your
* pipeline.
*
*
* @param createDistributionConfigurationRequest
* @return A Java Future containing the result of the CreateDistributionConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - IdempotentParameterMismatchException You have specified a client token for an operation using
* parameter values that differ from a previous request that used the same client token.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceInUseException The resource that you are trying to operate on is currently in use. Review the
* message details and retry later.
* - ResourceAlreadyExistsException The resource that you are trying to create already exists.
* - InvalidParameterCombinationException You have specified two or more mutually exclusive parameters.
* Review the error message for details.
* - ServiceQuotaExceededException You have exceeded the number of permitted resources or operations for
* this service. For service quotas, see EC2 Image
* Builder endpoints and quotas.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.CreateDistributionConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture createDistributionConfiguration(
CreateDistributionConfigurationRequest createDistributionConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
createDistributionConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDistributionConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateDistributionConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateDistributionConfiguration")
.withMarshaller(new CreateDistributionConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createDistributionConfigurationRequest));
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 new image. This request will create a new image along with all of the configured output resources
* defined in the distribution configuration. You must specify exactly one recipe for your image, using either a
* ContainerRecipeArn or an ImageRecipeArn.
*
*
* @param createImageRequest
* @return A Java Future containing the result of the CreateImage operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - IdempotentParameterMismatchException You have specified a client token for an operation using
* parameter values that differ from a previous request that used the same client token.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceInUseException The resource that you are trying to operate on is currently in use. Review the
* message details and retry later.
* - ServiceQuotaExceededException You have exceeded the number of permitted resources or operations for
* this service. For service quotas, see EC2 Image
* Builder endpoints and quotas.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.CreateImage
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createImage(CreateImageRequest createImageRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createImageRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateImage");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateImageResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateImage").withMarshaller(new CreateImageRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createImageRequest));
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 new image pipeline. Image pipelines enable you to automate the creation and distribution of images.
*
*
* @param createImagePipelineRequest
* @return A Java Future containing the result of the CreateImagePipeline operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - IdempotentParameterMismatchException You have specified a client token for an operation using
* parameter values that differ from a previous request that used the same client token.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceInUseException The resource that you are trying to operate on is currently in use. Review the
* message details and retry later.
* - ResourceAlreadyExistsException The resource that you are trying to create already exists.
* - ServiceQuotaExceededException You have exceeded the number of permitted resources or operations for
* this service. For service quotas, see EC2 Image
* Builder endpoints and quotas.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.CreateImagePipeline
* @see AWS API Documentation
*/
@Override
public CompletableFuture createImagePipeline(
CreateImagePipelineRequest createImagePipelineRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createImagePipelineRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateImagePipeline");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateImagePipelineResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateImagePipeline")
.withMarshaller(new CreateImagePipelineRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createImagePipelineRequest));
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 new image recipe. Image recipes define how images are configured, tested, and assessed.
*
*
* @param createImageRecipeRequest
* @return A Java Future containing the result of the CreateImageRecipe operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - IdempotentParameterMismatchException You have specified a client token for an operation using
* parameter values that differ from a previous request that used the same client token.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - InvalidVersionNumberException Your version number is out of bounds or does not follow the required
* syntax.
* - ResourceInUseException The resource that you are trying to operate on is currently in use. Review the
* message details and retry later.
* - ResourceAlreadyExistsException The resource that you are trying to create already exists.
* - ServiceQuotaExceededException You have exceeded the number of permitted resources or operations for
* this service. For service quotas, see EC2 Image
* Builder endpoints and quotas.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.CreateImageRecipe
* @see AWS API Documentation
*/
@Override
public CompletableFuture createImageRecipe(CreateImageRecipeRequest createImageRecipeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createImageRecipeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateImageRecipe");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateImageRecipeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateImageRecipe")
.withMarshaller(new CreateImageRecipeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createImageRecipeRequest));
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 new infrastructure configuration. An infrastructure configuration defines the environment in which your
* image will be built and tested.
*
*
* @param createInfrastructureConfigurationRequest
* @return A Java Future containing the result of the CreateInfrastructureConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - IdempotentParameterMismatchException You have specified a client token for an operation using
* parameter values that differ from a previous request that used the same client token.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceInUseException The resource that you are trying to operate on is currently in use. Review the
* message details and retry later.
* - ResourceAlreadyExistsException The resource that you are trying to create already exists.
* - ServiceQuotaExceededException You have exceeded the number of permitted resources or operations for
* this service. For service quotas, see EC2 Image
* Builder endpoints and quotas.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.CreateInfrastructureConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture createInfrastructureConfiguration(
CreateInfrastructureConfigurationRequest createInfrastructureConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
createInfrastructureConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateInfrastructureConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, CreateInfrastructureConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateInfrastructureConfiguration")
.withMarshaller(new CreateInfrastructureConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createInfrastructureConfigurationRequest));
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);
}
}
/**
*
* Deletes a component build version.
*
*
* @param deleteComponentRequest
* @return A Java Future containing the result of the DeleteComponent operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceDependencyException You have attempted to mutate or delete a resource with a dependency that
* prohibits this action. See the error message for more details.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.DeleteComponent
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteComponent(DeleteComponentRequest deleteComponentRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteComponentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteComponent");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteComponentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteComponent")
.withMarshaller(new DeleteComponentRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteComponentRequest));
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);
}
}
/**
*
* Deletes a container recipe.
*
*
* @param deleteContainerRecipeRequest
* @return A Java Future containing the result of the DeleteContainerRecipe operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceDependencyException You have attempted to mutate or delete a resource with a dependency that
* prohibits this action. See the error message for more details.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.DeleteContainerRecipe
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteContainerRecipe(
DeleteContainerRecipeRequest deleteContainerRecipeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteContainerRecipeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteContainerRecipe");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteContainerRecipeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteContainerRecipe")
.withMarshaller(new DeleteContainerRecipeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteContainerRecipeRequest));
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);
}
}
/**
*
* Deletes a distribution configuration.
*
*
* @param deleteDistributionConfigurationRequest
* @return A Java Future containing the result of the DeleteDistributionConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceDependencyException You have attempted to mutate or delete a resource with a dependency that
* prohibits this action. See the error message for more details.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.DeleteDistributionConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteDistributionConfiguration(
DeleteDistributionConfigurationRequest deleteDistributionConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteDistributionConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDistributionConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteDistributionConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDistributionConfiguration")
.withMarshaller(new DeleteDistributionConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteDistributionConfigurationRequest));
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);
}
}
/**
*
* Deletes an Image Builder image resource. This does not delete any EC2 AMIs or ECR container images that are
* created during the image build process. You must clean those up separately, using the appropriate Amazon EC2 or
* Amazon ECR console actions, or API or CLI commands.
*
*
* -
*
* To deregister an EC2 Linux AMI, see Deregister your Linux AMI in
* the Amazon EC2 User Guide .
*
*
* -
*
* To deregister an EC2 Windows AMI, see Deregister your Windows AMI
* in the Amazon EC2 Windows Guide .
*
*
* -
*
* To delete a container image from Amazon ECR, see Deleting an image in the
* Amazon ECR User Guide.
*
*
*
*
* @param deleteImageRequest
* @return A Java Future containing the result of the DeleteImage operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceDependencyException You have attempted to mutate or delete a resource with a dependency that
* prohibits this action. See the error message for more details.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.DeleteImage
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteImage(DeleteImageRequest deleteImageRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteImageRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteImage");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteImageResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteImage").withMarshaller(new DeleteImageRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteImageRequest));
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);
}
}
/**
*
* Deletes an image pipeline.
*
*
* @param deleteImagePipelineRequest
* @return A Java Future containing the result of the DeleteImagePipeline operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceDependencyException You have attempted to mutate or delete a resource with a dependency that
* prohibits this action. See the error message for more details.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.DeleteImagePipeline
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteImagePipeline(
DeleteImagePipelineRequest deleteImagePipelineRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteImagePipelineRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteImagePipeline");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteImagePipelineResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteImagePipeline")
.withMarshaller(new DeleteImagePipelineRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteImagePipelineRequest));
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);
}
}
/**
*
* Deletes an image recipe.
*
*
* @param deleteImageRecipeRequest
* @return A Java Future containing the result of the DeleteImageRecipe operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceDependencyException You have attempted to mutate or delete a resource with a dependency that
* prohibits this action. See the error message for more details.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.DeleteImageRecipe
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteImageRecipe(DeleteImageRecipeRequest deleteImageRecipeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteImageRecipeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteImageRecipe");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteImageRecipeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteImageRecipe")
.withMarshaller(new DeleteImageRecipeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteImageRecipeRequest));
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);
}
}
/**
*
* Deletes an infrastructure configuration.
*
*
* @param deleteInfrastructureConfigurationRequest
* @return A Java Future containing the result of the DeleteInfrastructureConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - ResourceDependencyException You have attempted to mutate or delete a resource with a dependency that
* prohibits this action. See the error message for more details.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.DeleteInfrastructureConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteInfrastructureConfiguration(
DeleteInfrastructureConfigurationRequest deleteInfrastructureConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteInfrastructureConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteInfrastructureConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, DeleteInfrastructureConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteInfrastructureConfiguration")
.withMarshaller(new DeleteInfrastructureConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteInfrastructureConfigurationRequest));
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 component object.
*
*
* @param getComponentRequest
* @return A Java Future containing the result of the GetComponent operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetComponent
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getComponent(GetComponentRequest getComponentRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getComponentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetComponent");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetComponentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetComponent").withMarshaller(new GetComponentRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getComponentRequest));
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 component policy.
*
*
* @param getComponentPolicyRequest
* @return A Java Future containing the result of the GetComponentPolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - ResourceNotFoundException At least one of the resources referenced by your request does not exist.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetComponentPolicy
* @see AWS API Documentation
*/
@Override
public CompletableFuture getComponentPolicy(GetComponentPolicyRequest getComponentPolicyRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getComponentPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetComponentPolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetComponentPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetComponentPolicy")
.withMarshaller(new GetComponentPolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getComponentPolicyRequest));
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 container recipe.
*
*
* @param getContainerRecipeRequest
* @return A Java Future containing the result of the GetContainerRecipe operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetContainerRecipe
* @see AWS API Documentation
*/
@Override
public CompletableFuture getContainerRecipe(GetContainerRecipeRequest getContainerRecipeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getContainerRecipeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetContainerRecipe");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetContainerRecipeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetContainerRecipe")
.withMarshaller(new GetContainerRecipeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getContainerRecipeRequest));
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 the policy for a container recipe.
*
*
* @param getContainerRecipePolicyRequest
* @return A Java Future containing the result of the GetContainerRecipePolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ResourceNotFoundException At least one of the resources referenced by your request does not exist.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetContainerRecipePolicy
* @see AWS API Documentation
*/
@Override
public CompletableFuture getContainerRecipePolicy(
GetContainerRecipePolicyRequest getContainerRecipePolicyRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getContainerRecipePolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetContainerRecipePolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetContainerRecipePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetContainerRecipePolicy")
.withMarshaller(new GetContainerRecipePolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getContainerRecipePolicyRequest));
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 distribution configuration.
*
*
* @param getDistributionConfigurationRequest
* @return A Java Future containing the result of the GetDistributionConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetDistributionConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture getDistributionConfiguration(
GetDistributionConfigurationRequest getDistributionConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getDistributionConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDistributionConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetDistributionConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetDistributionConfiguration")
.withMarshaller(new GetDistributionConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getDistributionConfigurationRequest));
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 an image.
*
*
* @param getImageRequest
* @return A Java Future containing the result of the GetImage operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetImage
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getImage(GetImageRequest getImageRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getImageRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetImage");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetImageResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("GetImage")
.withMarshaller(new GetImageRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.withInput(getImageRequest));
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 an image pipeline.
*
*
* @param getImagePipelineRequest
* @return A Java Future containing the result of the GetImagePipeline operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetImagePipeline
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getImagePipeline(GetImagePipelineRequest getImagePipelineRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getImagePipelineRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetImagePipeline");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetImagePipelineResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetImagePipeline")
.withMarshaller(new GetImagePipelineRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getImagePipelineRequest));
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 an image policy.
*
*
* @param getImagePolicyRequest
* @return A Java Future containing the result of the GetImagePolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - ResourceNotFoundException At least one of the resources referenced by your request does not exist.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetImagePolicy
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getImagePolicy(GetImagePolicyRequest getImagePolicyRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getImagePolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetImagePolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetImagePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetImagePolicy")
.withMarshaller(new GetImagePolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getImagePolicyRequest));
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 an image recipe.
*
*
* @param getImageRecipeRequest
* @return A Java Future containing the result of the GetImageRecipe operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetImageRecipe
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getImageRecipe(GetImageRecipeRequest getImageRecipeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getImageRecipeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetImageRecipe");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetImageRecipeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetImageRecipe")
.withMarshaller(new GetImageRecipeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getImageRecipeRequest));
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 an image recipe policy.
*
*
* @param getImageRecipePolicyRequest
* @return A Java Future containing the result of the GetImageRecipePolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ResourceNotFoundException At least one of the resources referenced by your request does not exist.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetImageRecipePolicy
* @see AWS API Documentation
*/
@Override
public CompletableFuture getImageRecipePolicy(
GetImageRecipePolicyRequest getImageRecipePolicyRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getImageRecipePolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetImageRecipePolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetImageRecipePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetImageRecipePolicy")
.withMarshaller(new GetImageRecipePolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getImageRecipePolicyRequest));
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 an infrastructure configuration.
*
*
* @param getInfrastructureConfigurationRequest
* GetInfrastructureConfiguration request object.
* @return A Java Future containing the result of the GetInfrastructureConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.GetInfrastructureConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture getInfrastructureConfiguration(
GetInfrastructureConfigurationRequest getInfrastructureConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getInfrastructureConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetInfrastructureConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetInfrastructureConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetInfrastructureConfiguration")
.withMarshaller(new GetInfrastructureConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getInfrastructureConfigurationRequest));
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);
}
}
/**
*
* Imports a component and transforms its data into a component document.
*
*
* @param importComponentRequest
* @return A Java Future containing the result of the ImportComponent operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - IdempotentParameterMismatchException You have specified a client token for an operation using
* parameter values that differ from a previous request that used the same client token.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - InvalidVersionNumberException Your version number is out of bounds or does not follow the required
* syntax.
* - ResourceInUseException The resource that you are trying to operate on is currently in use. Review the
* message details and retry later.
* - InvalidParameterCombinationException You have specified two or more mutually exclusive parameters.
* Review the error message for details.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ImportComponent
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture importComponent(ImportComponentRequest importComponentRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, importComponentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ImportComponent");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ImportComponentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ImportComponent")
.withMarshaller(new ImportComponentRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(importComponentRequest));
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);
}
}
/**
*
* When you export your virtual machine (VM) from its virtualization environment, that process creates a set of one
* or more disk container files that act as snapshots of your VM’s environment, settings, and data. The Amazon EC2
* API ImportImage action
* uses those files to import your VM and create an AMI. To import using the CLI command, see import-image
*
*
* You can reference the task ID from the VM import to pull in the AMI that the import created as the base image for
* your Image Builder recipe.
*
*
* @param importVmImageRequest
* @return A Java Future containing the result of the ImportVmImage operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ImportVmImage
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture importVmImage(ImportVmImageRequest importVmImageRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, importVmImageRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ImportVmImage");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ImportVmImageResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ImportVmImage")
.withMarshaller(new ImportVmImageRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(importVmImageRequest));
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);
}
}
/**
*
* Returns the list of component build versions for the specified semantic version.
*
*
*
* The semantic version has four nodes: <major>.<minor>.<patch>/<build>. You can assign
* values for the first three, and can filter on all of them.
*
*
* Filtering: With semantic versioning, you have the flexibility to use wildcards (x) to specify the most
* recent versions or nodes when selecting the base image or components for your recipe. When you use a wildcard in
* any node, all nodes to the right of the first wildcard must also be wildcards.
*
*
*
* @param listComponentBuildVersionsRequest
* @return A Java Future containing the result of the ListComponentBuildVersions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListComponentBuildVersions
* @see AWS API Documentation
*/
@Override
public CompletableFuture listComponentBuildVersions(
ListComponentBuildVersionsRequest listComponentBuildVersionsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listComponentBuildVersionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListComponentBuildVersions");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListComponentBuildVersionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListComponentBuildVersions")
.withMarshaller(new ListComponentBuildVersionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listComponentBuildVersionsRequest));
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);
}
}
/**
*
* Returns the list of component build versions for the specified semantic version.
*
*
*
* The semantic version has four nodes: <major>.<minor>.<patch>/<build>. You can assign
* values for the first three, and can filter on all of them.
*
*
* Filtering: With semantic versioning, you have the flexibility to use wildcards (x) to specify the most
* recent versions or nodes when selecting the base image or components for your recipe. When you use a wildcard in
* any node, all nodes to the right of the first wildcard must also be wildcards.
*
*
*
* This is a variant of
* {@link #listComponentBuildVersions(software.amazon.awssdk.services.imagebuilder.model.ListComponentBuildVersionsRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListComponentBuildVersionsPublisher publisher = client.listComponentBuildVersionsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListComponentBuildVersionsPublisher publisher = client.listComponentBuildVersionsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.imagebuilder.model.ListComponentBuildVersionsResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listComponentBuildVersions(software.amazon.awssdk.services.imagebuilder.model.ListComponentBuildVersionsRequest)}
* operation.
*
*
* @param listComponentBuildVersionsRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListComponentBuildVersions
* @see AWS API Documentation
*/
public ListComponentBuildVersionsPublisher listComponentBuildVersionsPaginator(
ListComponentBuildVersionsRequest listComponentBuildVersionsRequest) {
return new ListComponentBuildVersionsPublisher(this, applyPaginatorUserAgent(listComponentBuildVersionsRequest));
}
/**
*
* Returns the list of component build versions for the specified semantic version.
*
*
*
* The semantic version has four nodes: <major>.<minor>.<patch>/<build>. You can assign
* values for the first three, and can filter on all of them.
*
*
* Filtering: With semantic versioning, you have the flexibility to use wildcards (x) to specify the most
* recent versions or nodes when selecting the base image or components for your recipe. When you use a wildcard in
* any node, all nodes to the right of the first wildcard must also be wildcards.
*
*
*
* @param listComponentsRequest
* @return A Java Future containing the result of the ListComponents operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListComponents
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture listComponents(ListComponentsRequest listComponentsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listComponentsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListComponents");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListComponentsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListComponents")
.withMarshaller(new ListComponentsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listComponentsRequest));
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);
}
}
/**
*
* Returns the list of component build versions for the specified semantic version.
*
*
*
* The semantic version has four nodes: <major>.<minor>.<patch>/<build>. You can assign
* values for the first three, and can filter on all of them.
*
*
* Filtering: With semantic versioning, you have the flexibility to use wildcards (x) to specify the most
* recent versions or nodes when selecting the base image or components for your recipe. When you use a wildcard in
* any node, all nodes to the right of the first wildcard must also be wildcards.
*
*
*
* This is a variant of
* {@link #listComponents(software.amazon.awssdk.services.imagebuilder.model.ListComponentsRequest)} operation. The
* return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will
* internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListComponentsPublisher publisher = client.listComponentsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListComponentsPublisher publisher = client.listComponentsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.imagebuilder.model.ListComponentsResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listComponents(software.amazon.awssdk.services.imagebuilder.model.ListComponentsRequest)} operation.
*
*
* @param listComponentsRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListComponents
* @see AWS
* API Documentation
*/
public ListComponentsPublisher listComponentsPaginator(ListComponentsRequest listComponentsRequest) {
return new ListComponentsPublisher(this, applyPaginatorUserAgent(listComponentsRequest));
}
/**
*
* Returns a list of container recipes.
*
*
* @param listContainerRecipesRequest
* @return A Java Future containing the result of the ListContainerRecipes operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListContainerRecipes
* @see AWS API Documentation
*/
@Override
public CompletableFuture listContainerRecipes(
ListContainerRecipesRequest listContainerRecipesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listContainerRecipesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListContainerRecipes");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListContainerRecipesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListContainerRecipes")
.withMarshaller(new ListContainerRecipesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listContainerRecipesRequest));
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);
}
}
/**
*
* Returns a list of container recipes.
*
*
*
* This is a variant of
* {@link #listContainerRecipes(software.amazon.awssdk.services.imagebuilder.model.ListContainerRecipesRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListContainerRecipesPublisher publisher = client.listContainerRecipesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListContainerRecipesPublisher publisher = client.listContainerRecipesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.imagebuilder.model.ListContainerRecipesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listContainerRecipes(software.amazon.awssdk.services.imagebuilder.model.ListContainerRecipesRequest)}
* operation.
*
*
* @param listContainerRecipesRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListContainerRecipes
* @see AWS API Documentation
*/
public ListContainerRecipesPublisher listContainerRecipesPaginator(ListContainerRecipesRequest listContainerRecipesRequest) {
return new ListContainerRecipesPublisher(this, applyPaginatorUserAgent(listContainerRecipesRequest));
}
/**
*
* Returns a list of distribution configurations.
*
*
* @param listDistributionConfigurationsRequest
* @return A Java Future containing the result of the ListDistributionConfigurations operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListDistributionConfigurations
* @see AWS API Documentation
*/
@Override
public CompletableFuture listDistributionConfigurations(
ListDistributionConfigurationsRequest listDistributionConfigurationsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
listDistributionConfigurationsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDistributionConfigurations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListDistributionConfigurationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListDistributionConfigurations")
.withMarshaller(new ListDistributionConfigurationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listDistributionConfigurationsRequest));
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);
}
}
/**
*
* Returns a list of distribution configurations.
*
*
*
* This is a variant of
* {@link #listDistributionConfigurations(software.amazon.awssdk.services.imagebuilder.model.ListDistributionConfigurationsRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListDistributionConfigurationsPublisher publisher = client.listDistributionConfigurationsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListDistributionConfigurationsPublisher publisher = client.listDistributionConfigurationsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.imagebuilder.model.ListDistributionConfigurationsResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listDistributionConfigurations(software.amazon.awssdk.services.imagebuilder.model.ListDistributionConfigurationsRequest)}
* operation.
*
*
* @param listDistributionConfigurationsRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListDistributionConfigurations
* @see AWS API Documentation
*/
public ListDistributionConfigurationsPublisher listDistributionConfigurationsPaginator(
ListDistributionConfigurationsRequest listDistributionConfigurationsRequest) {
return new ListDistributionConfigurationsPublisher(this, applyPaginatorUserAgent(listDistributionConfigurationsRequest));
}
/**
*
* Returns a list of image build versions.
*
*
* @param listImageBuildVersionsRequest
* @return A Java Future containing the result of the ListImageBuildVersions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListImageBuildVersions
* @see AWS API Documentation
*/
@Override
public CompletableFuture listImageBuildVersions(
ListImageBuildVersionsRequest listImageBuildVersionsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listImageBuildVersionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListImageBuildVersions");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListImageBuildVersionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListImageBuildVersions")
.withMarshaller(new ListImageBuildVersionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listImageBuildVersionsRequest));
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);
}
}
/**
*
* Returns a list of image build versions.
*
*
*
* This is a variant of
* {@link #listImageBuildVersions(software.amazon.awssdk.services.imagebuilder.model.ListImageBuildVersionsRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListImageBuildVersionsPublisher publisher = client.listImageBuildVersionsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListImageBuildVersionsPublisher publisher = client.listImageBuildVersionsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.imagebuilder.model.ListImageBuildVersionsResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listImageBuildVersions(software.amazon.awssdk.services.imagebuilder.model.ListImageBuildVersionsRequest)}
* operation.
*
*
* @param listImageBuildVersionsRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListImageBuildVersions
* @see AWS API Documentation
*/
public ListImageBuildVersionsPublisher listImageBuildVersionsPaginator(
ListImageBuildVersionsRequest listImageBuildVersionsRequest) {
return new ListImageBuildVersionsPublisher(this, applyPaginatorUserAgent(listImageBuildVersionsRequest));
}
/**
*
* List the Packages that are associated with an Image Build Version, as determined by Amazon Web Services Systems
* Manager Inventory at build time.
*
*
* @param listImagePackagesRequest
* @return A Java Future containing the result of the ListImagePackages operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ResourceNotFoundException At least one of the resources referenced by your request does not exist.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListImagePackages
* @see AWS API Documentation
*/
@Override
public CompletableFuture listImagePackages(ListImagePackagesRequest listImagePackagesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listImagePackagesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListImagePackages");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListImagePackagesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListImagePackages")
.withMarshaller(new ListImagePackagesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listImagePackagesRequest));
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 the Packages that are associated with an Image Build Version, as determined by Amazon Web Services Systems
* Manager Inventory at build time.
*
*
*
* This is a variant of
* {@link #listImagePackages(software.amazon.awssdk.services.imagebuilder.model.ListImagePackagesRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListImagePackagesPublisher publisher = client.listImagePackagesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListImagePackagesPublisher publisher = client.listImagePackagesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.imagebuilder.model.ListImagePackagesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listImagePackages(software.amazon.awssdk.services.imagebuilder.model.ListImagePackagesRequest)}
* operation.
*
*
* @param listImagePackagesRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ResourceNotFoundException At least one of the resources referenced by your request does not exist.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListImagePackages
* @see AWS API Documentation
*/
public ListImagePackagesPublisher listImagePackagesPaginator(ListImagePackagesRequest listImagePackagesRequest) {
return new ListImagePackagesPublisher(this, applyPaginatorUserAgent(listImagePackagesRequest));
}
/**
*
* Returns a list of images created by the specified pipeline.
*
*
* @param listImagePipelineImagesRequest
* @return A Java Future containing the result of the ListImagePipelineImages operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ResourceNotFoundException At least one of the resources referenced by your request does not exist.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListImagePipelineImages
* @see AWS API Documentation
*/
@Override
public CompletableFuture listImagePipelineImages(
ListImagePipelineImagesRequest listImagePipelineImagesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listImagePipelineImagesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListImagePipelineImages");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListImagePipelineImagesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListImagePipelineImages")
.withMarshaller(new ListImagePipelineImagesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listImagePipelineImagesRequest));
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);
}
}
/**
*
* Returns a list of images created by the specified pipeline.
*
*
*
* This is a variant of
* {@link #listImagePipelineImages(software.amazon.awssdk.services.imagebuilder.model.ListImagePipelineImagesRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListImagePipelineImagesPublisher publisher = client.listImagePipelineImagesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.imagebuilder.paginators.ListImagePipelineImagesPublisher publisher = client.listImagePipelineImagesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.imagebuilder.model.ListImagePipelineImagesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listImagePipelineImages(software.amazon.awssdk.services.imagebuilder.model.ListImagePipelineImagesRequest)}
* operation.
*
*
* @param listImagePipelineImagesRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ResourceNotFoundException At least one of the resources referenced by your request does not exist.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListImagePipelineImages
* @see AWS API Documentation
*/
public ListImagePipelineImagesPublisher listImagePipelineImagesPaginator(
ListImagePipelineImagesRequest listImagePipelineImagesRequest) {
return new ListImagePipelineImagesPublisher(this, applyPaginatorUserAgent(listImagePipelineImagesRequest));
}
/**
*
* Returns a list of image pipelines.
*
*
* @param listImagePipelinesRequest
* @return A Java Future containing the result of the ListImagePipelines operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceException This exception is thrown when the service encounters an unrecoverable exception.
* - ClientException These errors are usually caused by a client action, such as using an action or
* resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying
* an invalid resource identifier.
* - ServiceUnavailableException The service is unable to process your request at this time.
* - InvalidRequestException You have made a request for an action that is not supported by the service.
* - InvalidPaginationTokenException You have provided an invalid pagination token in your request.
* - ForbiddenException You are not authorized to perform the requested operation.
* - CallRateLimitExceededException You have exceeded the permitted request rate for the specific
* operation.
* - 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.
* - ImagebuilderException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample ImagebuilderAsyncClient.ListImagePipelines
* @see AWS API Documentation
*/
@Override
public CompletableFuture listImagePipelines(ListImagePipelinesRequest listImagePipelinesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listImagePipelinesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "imagebuilder");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListImagePipelines");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListImagePipelinesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams