software.amazon.awssdk.services.apprunner.DefaultAppRunnerAsyncClient Maven / Gradle / Ivy
Show all versions of apprunner Show documentation
/*
* 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.apprunner;
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.apprunner.model.AppRunnerException;
import software.amazon.awssdk.services.apprunner.model.AppRunnerRequest;
import software.amazon.awssdk.services.apprunner.model.AssociateCustomDomainRequest;
import software.amazon.awssdk.services.apprunner.model.AssociateCustomDomainResponse;
import software.amazon.awssdk.services.apprunner.model.CreateAutoScalingConfigurationRequest;
import software.amazon.awssdk.services.apprunner.model.CreateAutoScalingConfigurationResponse;
import software.amazon.awssdk.services.apprunner.model.CreateConnectionRequest;
import software.amazon.awssdk.services.apprunner.model.CreateConnectionResponse;
import software.amazon.awssdk.services.apprunner.model.CreateServiceRequest;
import software.amazon.awssdk.services.apprunner.model.CreateServiceResponse;
import software.amazon.awssdk.services.apprunner.model.CreateVpcConnectorRequest;
import software.amazon.awssdk.services.apprunner.model.CreateVpcConnectorResponse;
import software.amazon.awssdk.services.apprunner.model.DeleteAutoScalingConfigurationRequest;
import software.amazon.awssdk.services.apprunner.model.DeleteAutoScalingConfigurationResponse;
import software.amazon.awssdk.services.apprunner.model.DeleteConnectionRequest;
import software.amazon.awssdk.services.apprunner.model.DeleteConnectionResponse;
import software.amazon.awssdk.services.apprunner.model.DeleteServiceRequest;
import software.amazon.awssdk.services.apprunner.model.DeleteServiceResponse;
import software.amazon.awssdk.services.apprunner.model.DeleteVpcConnectorRequest;
import software.amazon.awssdk.services.apprunner.model.DeleteVpcConnectorResponse;
import software.amazon.awssdk.services.apprunner.model.DescribeAutoScalingConfigurationRequest;
import software.amazon.awssdk.services.apprunner.model.DescribeAutoScalingConfigurationResponse;
import software.amazon.awssdk.services.apprunner.model.DescribeCustomDomainsRequest;
import software.amazon.awssdk.services.apprunner.model.DescribeCustomDomainsResponse;
import software.amazon.awssdk.services.apprunner.model.DescribeServiceRequest;
import software.amazon.awssdk.services.apprunner.model.DescribeServiceResponse;
import software.amazon.awssdk.services.apprunner.model.DescribeVpcConnectorRequest;
import software.amazon.awssdk.services.apprunner.model.DescribeVpcConnectorResponse;
import software.amazon.awssdk.services.apprunner.model.DisassociateCustomDomainRequest;
import software.amazon.awssdk.services.apprunner.model.DisassociateCustomDomainResponse;
import software.amazon.awssdk.services.apprunner.model.InternalServiceErrorException;
import software.amazon.awssdk.services.apprunner.model.InvalidRequestException;
import software.amazon.awssdk.services.apprunner.model.InvalidStateException;
import software.amazon.awssdk.services.apprunner.model.ListAutoScalingConfigurationsRequest;
import software.amazon.awssdk.services.apprunner.model.ListAutoScalingConfigurationsResponse;
import software.amazon.awssdk.services.apprunner.model.ListConnectionsRequest;
import software.amazon.awssdk.services.apprunner.model.ListConnectionsResponse;
import software.amazon.awssdk.services.apprunner.model.ListOperationsRequest;
import software.amazon.awssdk.services.apprunner.model.ListOperationsResponse;
import software.amazon.awssdk.services.apprunner.model.ListServicesRequest;
import software.amazon.awssdk.services.apprunner.model.ListServicesResponse;
import software.amazon.awssdk.services.apprunner.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.apprunner.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.apprunner.model.ListVpcConnectorsRequest;
import software.amazon.awssdk.services.apprunner.model.ListVpcConnectorsResponse;
import software.amazon.awssdk.services.apprunner.model.PauseServiceRequest;
import software.amazon.awssdk.services.apprunner.model.PauseServiceResponse;
import software.amazon.awssdk.services.apprunner.model.ResourceNotFoundException;
import software.amazon.awssdk.services.apprunner.model.ResumeServiceRequest;
import software.amazon.awssdk.services.apprunner.model.ResumeServiceResponse;
import software.amazon.awssdk.services.apprunner.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.apprunner.model.StartDeploymentRequest;
import software.amazon.awssdk.services.apprunner.model.StartDeploymentResponse;
import software.amazon.awssdk.services.apprunner.model.TagResourceRequest;
import software.amazon.awssdk.services.apprunner.model.TagResourceResponse;
import software.amazon.awssdk.services.apprunner.model.UntagResourceRequest;
import software.amazon.awssdk.services.apprunner.model.UntagResourceResponse;
import software.amazon.awssdk.services.apprunner.model.UpdateServiceRequest;
import software.amazon.awssdk.services.apprunner.model.UpdateServiceResponse;
import software.amazon.awssdk.services.apprunner.paginators.DescribeCustomDomainsPublisher;
import software.amazon.awssdk.services.apprunner.paginators.ListAutoScalingConfigurationsPublisher;
import software.amazon.awssdk.services.apprunner.paginators.ListConnectionsPublisher;
import software.amazon.awssdk.services.apprunner.paginators.ListOperationsPublisher;
import software.amazon.awssdk.services.apprunner.paginators.ListServicesPublisher;
import software.amazon.awssdk.services.apprunner.paginators.ListVpcConnectorsPublisher;
import software.amazon.awssdk.services.apprunner.transform.AssociateCustomDomainRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.CreateAutoScalingConfigurationRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.CreateConnectionRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.CreateServiceRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.CreateVpcConnectorRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.DeleteAutoScalingConfigurationRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.DeleteConnectionRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.DeleteServiceRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.DeleteVpcConnectorRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.DescribeAutoScalingConfigurationRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.DescribeCustomDomainsRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.DescribeServiceRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.DescribeVpcConnectorRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.DisassociateCustomDomainRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.ListAutoScalingConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.ListConnectionsRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.ListOperationsRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.ListServicesRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.ListVpcConnectorsRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.PauseServiceRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.ResumeServiceRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.StartDeploymentRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.apprunner.transform.UpdateServiceRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link AppRunnerAsyncClient}.
*
* @see AppRunnerAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultAppRunnerAsyncClient implements AppRunnerAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultAppRunnerAsyncClient.class);
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultAppRunnerAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Associate your own domain name with the App Runner subdomain URL of your App Runner service.
*
*
* After you call AssociateCustomDomain
and receive a successful response, use the information in the
* CustomDomain record that's returned to add CNAME records to your Domain Name System (DNS). For each mapped
* domain name, add a mapping to the target App Runner subdomain and one or more certificate validation records. App
* Runner then performs DNS validation to verify that you own or control the domain name that you associated. App
* Runner tracks domain validity in a certificate stored in AWS Certificate Manager (ACM).
*
*
* @param associateCustomDomainRequest
* @return A Java Future containing the result of the AssociateCustomDomain operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - InvalidStateException You can't perform this action when the resource is in its current state.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.AssociateCustomDomain
* @see AWS API Documentation
*/
@Override
public CompletableFuture associateCustomDomain(
AssociateCustomDomainRequest associateCustomDomainRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, associateCustomDomainRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AssociateCustomDomain");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AssociateCustomDomainResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AssociateCustomDomain")
.withMarshaller(new AssociateCustomDomainRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(associateCustomDomainRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Create an App Runner automatic scaling configuration resource. App Runner requires this resource when you create
* App Runner services that require non-default auto scaling settings. You can share an auto scaling configuration
* across multiple services.
*
*
* Create multiple revisions of a configuration by calling this action multiple times using the same
* AutoScalingConfigurationName
. The call returns incremental
* AutoScalingConfigurationRevision
values. When you create a service, you can set it to use the latest
* active revision of an auto scaling configuration or a specific revision.
*
*
* Configure a higher MinSize
to increase the spread of your App Runner service over more Availability
* Zones in the Amazon Web Services Region. The tradeoff is a higher minimal cost.
*
*
* Configure a lower MaxSize
to control your cost. The tradeoff is lower responsiveness during peak
* demand.
*
*
* @param createAutoScalingConfigurationRequest
* @return A Java Future containing the result of the CreateAutoScalingConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ServiceQuotaExceededException App Runner can't create this resource. You've reached your account
* quota for this resource type.
*
* For App Runner per-resource quotas, see App Runner endpoints and quotas
* in the Amazon Web Services General Reference.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.CreateAutoScalingConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture createAutoScalingConfiguration(
CreateAutoScalingConfigurationRequest createAutoScalingConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
createAutoScalingConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAutoScalingConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateAutoScalingConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateAutoScalingConfiguration")
.withMarshaller(new CreateAutoScalingConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createAutoScalingConfigurationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Create an App Runner connection resource. App Runner requires a connection resource when you create App Runner
* services that access private repositories from certain third-party providers. You can share a connection across
* multiple services.
*
*
* A connection resource is needed to access GitHub repositories. GitHub requires a user interface approval process
* through the App Runner console before you can use the connection.
*
*
* @param createConnectionRequest
* @return A Java Future containing the result of the CreateConnection operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ServiceQuotaExceededException App Runner can't create this resource. You've reached your account
* quota for this resource type.
*
* For App Runner per-resource quotas, see App Runner endpoints and quotas
* in the Amazon Web Services General Reference.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.CreateConnection
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createConnection(CreateConnectionRequest createConnectionRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createConnectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateConnection");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateConnectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateConnection")
.withMarshaller(new CreateConnectionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createConnectionRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Create an App Runner service. After the service is created, the action also automatically starts a deployment.
*
*
* This is an asynchronous operation. On a successful call, you can use the returned OperationId
and
* the ListOperations call to
* track the operation's progress.
*
*
* @param createServiceRequest
* @return A Java Future containing the result of the CreateService operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ServiceQuotaExceededException App Runner can't create this resource. You've reached your account
* quota for this resource type.
*
* For App Runner per-resource quotas, see App Runner endpoints and quotas
* in the Amazon Web Services General Reference.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.CreateService
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createService(CreateServiceRequest createServiceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createServiceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateService");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateServiceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateService")
.withMarshaller(new CreateServiceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createServiceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Create an App Runner VPC connector resource. App Runner requires this resource when you want to associate your
* App Runner service to a custom Amazon Virtual Private Cloud (Amazon VPC).
*
*
* @param createVpcConnectorRequest
* @return A Java Future containing the result of the CreateVpcConnector operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ServiceQuotaExceededException App Runner can't create this resource. You've reached your account
* quota for this resource type.
*
* For App Runner per-resource quotas, see App Runner endpoints and quotas
* in the Amazon Web Services General Reference.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.CreateVpcConnector
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createVpcConnector(CreateVpcConnectorRequest createVpcConnectorRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createVpcConnectorRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateVpcConnector");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateVpcConnectorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateVpcConnector")
.withMarshaller(new CreateVpcConnectorRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createVpcConnectorRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Delete an App Runner automatic scaling configuration resource. You can delete a specific revision or the latest
* active revision. You can't delete a configuration that's used by one or more App Runner services.
*
*
* @param deleteAutoScalingConfigurationRequest
* @return A Java Future containing the result of the DeleteAutoScalingConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.DeleteAutoScalingConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteAutoScalingConfiguration(
DeleteAutoScalingConfigurationRequest deleteAutoScalingConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteAutoScalingConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAutoScalingConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteAutoScalingConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteAutoScalingConfiguration")
.withMarshaller(new DeleteAutoScalingConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteAutoScalingConfigurationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Delete an App Runner connection. You must first ensure that there are no running App Runner services that use
* this connection. If there are any, the DeleteConnection
action fails.
*
*
* @param deleteConnectionRequest
* @return A Java Future containing the result of the DeleteConnection operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.DeleteConnection
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteConnection(DeleteConnectionRequest deleteConnectionRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteConnectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteConnection");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteConnectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteConnection")
.withMarshaller(new DeleteConnectionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteConnectionRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Delete an App Runner service.
*
*
* This is an asynchronous operation. On a successful call, you can use the returned OperationId
and
* the ListOperations call to track the operation's progress.
*
*
* @param deleteServiceRequest
* @return A Java Future containing the result of the DeleteService operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InvalidStateException You can't perform this action when the resource is in its current state.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.DeleteService
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteService(DeleteServiceRequest deleteServiceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteServiceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteService");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteServiceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteService")
.withMarshaller(new DeleteServiceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteServiceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Delete an App Runner VPC connector resource. You can't delete a connector that's used by one or more App Runner
* services.
*
*
* @param deleteVpcConnectorRequest
* @return A Java Future containing the result of the DeleteVpcConnector operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.DeleteVpcConnector
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteVpcConnector(DeleteVpcConnectorRequest deleteVpcConnectorRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteVpcConnectorRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteVpcConnector");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteVpcConnectorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteVpcConnector")
.withMarshaller(new DeleteVpcConnectorRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteVpcConnectorRequest));
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);
}
}
/**
*
* Return a full description of an App Runner automatic scaling configuration resource.
*
*
* @param describeAutoScalingConfigurationRequest
* @return A Java Future containing the result of the DescribeAutoScalingConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.DescribeAutoScalingConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture describeAutoScalingConfiguration(
DescribeAutoScalingConfigurationRequest describeAutoScalingConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
describeAutoScalingConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAutoScalingConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, DescribeAutoScalingConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeAutoScalingConfiguration")
.withMarshaller(new DescribeAutoScalingConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeAutoScalingConfigurationRequest));
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);
}
}
/**
*
* Return a description of custom domain names that are associated with an App Runner service.
*
*
* @param describeCustomDomainsRequest
* @return A Java Future containing the result of the DescribeCustomDomains operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.DescribeCustomDomains
* @see AWS API Documentation
*/
@Override
public CompletableFuture describeCustomDomains(
DescribeCustomDomainsRequest describeCustomDomainsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeCustomDomainsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeCustomDomains");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeCustomDomainsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeCustomDomains")
.withMarshaller(new DescribeCustomDomainsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeCustomDomainsRequest));
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);
}
}
/**
*
* Return a description of custom domain names that are associated with an App Runner service.
*
*
*
* This is a variant of
* {@link #describeCustomDomains(software.amazon.awssdk.services.apprunner.model.DescribeCustomDomainsRequest)}
* 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.apprunner.paginators.DescribeCustomDomainsPublisher publisher = client.describeCustomDomainsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.apprunner.paginators.DescribeCustomDomainsPublisher publisher = client.describeCustomDomainsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.apprunner.model.DescribeCustomDomainsResponse 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 #describeCustomDomains(software.amazon.awssdk.services.apprunner.model.DescribeCustomDomainsRequest)}
* operation.
*
*
* @param describeCustomDomainsRequest
* @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.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.DescribeCustomDomains
* @see AWS API Documentation
*/
public DescribeCustomDomainsPublisher describeCustomDomainsPaginator(DescribeCustomDomainsRequest describeCustomDomainsRequest) {
return new DescribeCustomDomainsPublisher(this, applyPaginatorUserAgent(describeCustomDomainsRequest));
}
/**
*
* Return a full description of an App Runner service.
*
*
* @param describeServiceRequest
* @return A Java Future containing the result of the DescribeService operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.DescribeService
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeService(DescribeServiceRequest describeServiceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeServiceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeService");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeServiceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeService")
.withMarshaller(new DescribeServiceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeServiceRequest));
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);
}
}
/**
*
* Return a description of an App Runner VPC connector resource.
*
*
* @param describeVpcConnectorRequest
* @return A Java Future containing the result of the DescribeVpcConnector operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.DescribeVpcConnector
* @see AWS API Documentation
*/
@Override
public CompletableFuture describeVpcConnector(
DescribeVpcConnectorRequest describeVpcConnectorRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeVpcConnectorRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeVpcConnector");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeVpcConnectorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeVpcConnector")
.withMarshaller(new DescribeVpcConnectorRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeVpcConnectorRequest));
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);
}
}
/**
*
* Disassociate a custom domain name from an App Runner service.
*
*
* Certificates tracking domain validity are associated with a custom domain and are stored in AWS Certificate Manager (ACM). These certificates
* aren't deleted as part of this action. App Runner delays certificate deletion for 30 days after a domain is
* disassociated from your service.
*
*
* @param disassociateCustomDomainRequest
* @return A Java Future containing the result of the DisassociateCustomDomain operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InvalidStateException You can't perform this action when the resource is in its current state.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.DisassociateCustomDomain
* @see AWS API Documentation
*/
@Override
public CompletableFuture disassociateCustomDomain(
DisassociateCustomDomainRequest disassociateCustomDomainRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateCustomDomainRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateCustomDomain");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DisassociateCustomDomainResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DisassociateCustomDomain")
.withMarshaller(new DisassociateCustomDomainRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(disassociateCustomDomainRequest));
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 App Runner automatic scaling configurations in your Amazon Web Services account. You can query
* the revisions for a specific configuration name or the revisions for all configurations in your account. You can
* optionally query only the latest revision of each requested name.
*
*
* @param listAutoScalingConfigurationsRequest
* @return A Java Future containing the result of the ListAutoScalingConfigurations operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListAutoScalingConfigurations
* @see AWS API Documentation
*/
@Override
public CompletableFuture listAutoScalingConfigurations(
ListAutoScalingConfigurationsRequest listAutoScalingConfigurationsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
listAutoScalingConfigurationsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAutoScalingConfigurations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListAutoScalingConfigurationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListAutoScalingConfigurations")
.withMarshaller(new ListAutoScalingConfigurationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listAutoScalingConfigurationsRequest));
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 App Runner automatic scaling configurations in your Amazon Web Services account. You can query
* the revisions for a specific configuration name or the revisions for all configurations in your account. You can
* optionally query only the latest revision of each requested name.
*
*
*
* This is a variant of
* {@link #listAutoScalingConfigurations(software.amazon.awssdk.services.apprunner.model.ListAutoScalingConfigurationsRequest)}
* 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.apprunner.paginators.ListAutoScalingConfigurationsPublisher publisher = client.listAutoScalingConfigurationsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.apprunner.paginators.ListAutoScalingConfigurationsPublisher publisher = client.listAutoScalingConfigurationsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.apprunner.model.ListAutoScalingConfigurationsResponse 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 #listAutoScalingConfigurations(software.amazon.awssdk.services.apprunner.model.ListAutoScalingConfigurationsRequest)}
* operation.
*
*
* @param listAutoScalingConfigurationsRequest
* @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.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListAutoScalingConfigurations
* @see AWS API Documentation
*/
public ListAutoScalingConfigurationsPublisher listAutoScalingConfigurationsPaginator(
ListAutoScalingConfigurationsRequest listAutoScalingConfigurationsRequest) {
return new ListAutoScalingConfigurationsPublisher(this, applyPaginatorUserAgent(listAutoScalingConfigurationsRequest));
}
/**
*
* Returns a list of App Runner connections that are associated with your Amazon Web Services account.
*
*
* @param listConnectionsRequest
* @return A Java Future containing the result of the ListConnections operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListConnections
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listConnections(ListConnectionsRequest listConnectionsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listConnectionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListConnections");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListConnectionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListConnections")
.withMarshaller(new ListConnectionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listConnectionsRequest));
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 App Runner connections that are associated with your Amazon Web Services account.
*
*
*
* This is a variant of
* {@link #listConnections(software.amazon.awssdk.services.apprunner.model.ListConnectionsRequest)} 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.apprunner.paginators.ListConnectionsPublisher publisher = client.listConnectionsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.apprunner.paginators.ListConnectionsPublisher publisher = client.listConnectionsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.apprunner.model.ListConnectionsResponse 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 #listConnections(software.amazon.awssdk.services.apprunner.model.ListConnectionsRequest)} operation.
*
*
* @param listConnectionsRequest
* @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.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListConnections
* @see AWS API
* Documentation
*/
public ListConnectionsPublisher listConnectionsPaginator(ListConnectionsRequest listConnectionsRequest) {
return new ListConnectionsPublisher(this, applyPaginatorUserAgent(listConnectionsRequest));
}
/**
*
* Return a list of operations that occurred on an App Runner service.
*
*
* The resulting list of OperationSummary objects is sorted in reverse chronological order. The first object
* on the list represents the last started operation.
*
*
* @param listOperationsRequest
* @return A Java Future containing the result of the ListOperations operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListOperations
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listOperations(ListOperationsRequest listOperationsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listOperationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListOperations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListOperationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListOperations")
.withMarshaller(new ListOperationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listOperationsRequest));
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);
}
}
/**
*
* Return a list of operations that occurred on an App Runner service.
*
*
* The resulting list of OperationSummary objects is sorted in reverse chronological order. The first object
* on the list represents the last started operation.
*
*
*
* This is a variant of
* {@link #listOperations(software.amazon.awssdk.services.apprunner.model.ListOperationsRequest)} 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.apprunner.paginators.ListOperationsPublisher publisher = client.listOperationsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.apprunner.paginators.ListOperationsPublisher publisher = client.listOperationsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.apprunner.model.ListOperationsResponse 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 #listOperations(software.amazon.awssdk.services.apprunner.model.ListOperationsRequest)} operation.
*
*
* @param listOperationsRequest
* @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.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListOperations
* @see AWS API
* Documentation
*/
public ListOperationsPublisher listOperationsPaginator(ListOperationsRequest listOperationsRequest) {
return new ListOperationsPublisher(this, applyPaginatorUserAgent(listOperationsRequest));
}
/**
*
* Returns a list of running App Runner services in your Amazon Web Services account.
*
*
* @param listServicesRequest
* @return A Java Future containing the result of the ListServices operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListServices
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listServices(ListServicesRequest listServicesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listServicesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListServices");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListServicesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListServices").withMarshaller(new ListServicesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listServicesRequest));
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 running App Runner services in your Amazon Web Services account.
*
*
*
* This is a variant of {@link #listServices(software.amazon.awssdk.services.apprunner.model.ListServicesRequest)}
* 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.apprunner.paginators.ListServicesPublisher publisher = client.listServicesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.apprunner.paginators.ListServicesPublisher publisher = client.listServicesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.apprunner.model.ListServicesResponse 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 #listServices(software.amazon.awssdk.services.apprunner.model.ListServicesRequest)} operation.
*
*
* @param listServicesRequest
* @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.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListServices
* @see AWS API
* Documentation
*/
public ListServicesPublisher listServicesPaginator(ListServicesRequest listServicesRequest) {
return new ListServicesPublisher(this, applyPaginatorUserAgent(listServicesRequest));
}
/**
*
* List tags that are associated with for an App Runner resource. The response contains a list of tag key-value
* pairs.
*
*
* @param listTagsForResourceRequest
* @return A Java Future containing the result of the ListTagsForResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InternalServiceErrorException An unexpected service exception occurred.
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InvalidStateException You can't perform this action when the resource is in its current state.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListTagsForResource
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture listTagsForResource(
ListTagsForResourceRequest listTagsForResourceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource")
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listTagsForResourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Returns a list of App Runner VPC connectors in your Amazon Web Services account.
*
*
* @param listVpcConnectorsRequest
* @return A Java Future containing the result of the ListVpcConnectors operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListVpcConnectors
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture listVpcConnectors(ListVpcConnectorsRequest listVpcConnectorsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listVpcConnectorsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListVpcConnectors");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListVpcConnectorsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListVpcConnectors")
.withMarshaller(new ListVpcConnectorsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listVpcConnectorsRequest));
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 App Runner VPC connectors in your Amazon Web Services account.
*
*
*
* This is a variant of
* {@link #listVpcConnectors(software.amazon.awssdk.services.apprunner.model.ListVpcConnectorsRequest)} 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.apprunner.paginators.ListVpcConnectorsPublisher publisher = client.listVpcConnectorsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.apprunner.paginators.ListVpcConnectorsPublisher publisher = client.listVpcConnectorsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.apprunner.model.ListVpcConnectorsResponse 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 #listVpcConnectors(software.amazon.awssdk.services.apprunner.model.ListVpcConnectorsRequest)}
* operation.
*
*
* @param listVpcConnectorsRequest
* @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.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ListVpcConnectors
* @see AWS
* API Documentation
*/
public ListVpcConnectorsPublisher listVpcConnectorsPaginator(ListVpcConnectorsRequest listVpcConnectorsRequest) {
return new ListVpcConnectorsPublisher(this, applyPaginatorUserAgent(listVpcConnectorsRequest));
}
/**
*
* Pause an active App Runner service. App Runner reduces compute capacity for the service to zero and loses state
* (for example, ephemeral storage is removed).
*
*
* This is an asynchronous operation. On a successful call, you can use the returned OperationId
and
* the ListOperations call to track the operation's progress.
*
*
* @param pauseServiceRequest
* @return A Java Future containing the result of the PauseService operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InternalServiceErrorException An unexpected service exception occurred.
* - InvalidStateException You can't perform this action when the resource is in its current state.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.PauseService
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture pauseService(PauseServiceRequest pauseServiceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, pauseServiceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PauseService");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
PauseServiceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("PauseService").withMarshaller(new PauseServiceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(pauseServiceRequest));
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);
}
}
/**
*
* Resume an active App Runner service. App Runner provisions compute capacity for the service.
*
*
* This is an asynchronous operation. On a successful call, you can use the returned OperationId
and
* the ListOperations call to track the operation's progress.
*
*
* @param resumeServiceRequest
* @return A Java Future containing the result of the ResumeService operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InternalServiceErrorException An unexpected service exception occurred.
* - InvalidStateException You can't perform this action when the resource is in its current state.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.ResumeService
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture resumeService(ResumeServiceRequest resumeServiceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, resumeServiceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ResumeService");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ResumeServiceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ResumeService")
.withMarshaller(new ResumeServiceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(resumeServiceRequest));
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);
}
}
/**
*
* Initiate a manual deployment of the latest commit in a source code repository or the latest image in a source
* image repository to an App Runner service.
*
*
* For a source code repository, App Runner retrieves the commit and builds a Docker image. For a source image
* repository, App Runner retrieves the latest Docker image. In both cases, App Runner then deploys the new image to
* your service and starts a new container instance.
*
*
* This is an asynchronous operation. On a successful call, you can use the returned OperationId
and
* the ListOperations call to track the operation's progress.
*
*
* @param startDeploymentRequest
* @return A Java Future containing the result of the StartDeployment operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.StartDeployment
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture startDeployment(StartDeploymentRequest startDeploymentRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, startDeploymentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartDeployment");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, StartDeploymentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("StartDeployment")
.withMarshaller(new StartDeploymentRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(startDeploymentRequest));
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);
}
}
/**
*
* Add tags to, or update the tag values of, an App Runner resource. A tag is a key-value pair.
*
*
* @param tagResourceRequest
* @return A Java Future containing the result of the TagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InternalServiceErrorException An unexpected service exception occurred.
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InvalidStateException You can't perform this action when the resource is in its current state.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.TagResource
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture tagResource(TagResourceRequest tagResourceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("TagResource").withMarshaller(new TagResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(tagResourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Remove tags from an App Runner resource.
*
*
* @param untagResourceRequest
* @return A Java Future containing the result of the UntagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InternalServiceErrorException An unexpected service exception occurred.
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - InvalidStateException You can't perform this action when the resource is in its current state.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.UntagResource
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture untagResource(UntagResourceRequest untagResourceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UntagResource")
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(untagResourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Update an App Runner service. You can update the source configuration and instance configuration of the service.
* You can also update the ARN of the auto scaling configuration resource that's associated with the service.
* However, you can't change the name or the encryption configuration of the service. These can be set only when you
* create the service.
*
*
* To update the tags applied to your service, use the separate actions TagResource and UntagResource.
*
*
* This is an asynchronous operation. On a successful call, you can use the returned OperationId
and
* the ListOperations call to track the operation's progress.
*
*
* @param updateServiceRequest
* @return A Java Future containing the result of the UpdateService operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException One or more input parameters aren't valid. Refer to the API action's document
* page, correct the input parameters, and try the action again.
* - ResourceNotFoundException A resource doesn't exist for the specified Amazon Resource Name (ARN) in
* your Amazon Web Services account.
* - InvalidStateException You can't perform this action when the resource is in its current state.
* - InternalServiceErrorException An unexpected service exception occurred.
* - 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.
* - AppRunnerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample AppRunnerAsyncClient.UpdateService
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture updateService(UpdateServiceRequest updateServiceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateServiceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "AppRunner");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateService");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateServiceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateService")
.withMarshaller(new UpdateServiceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateServiceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
@Override
public void close() {
clientHandler.close();
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(AppRunnerException::builder)
.protocol(AwsJsonProtocol.AWS_JSON)
.protocolVersion("1.0")
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidRequestException")
.exceptionBuilderSupplier(InvalidRequestException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServiceErrorException")
.exceptionBuilderSupplier(InternalServiceErrorException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ServiceQuotaExceededException")
.exceptionBuilderSupplier(ServiceQuotaExceededException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidStateException")
.exceptionBuilderSupplier(InvalidStateException::builder).build());
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
}
if (publishers == null || publishers.isEmpty()) {
publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
}
if (publishers == null) {
publishers = Collections.emptyList();
}
return publishers;
}
private T applyPaginatorUserAgent(T request) {
Consumer userAgentApplier = b -> b.addApiName(ApiName.builder()
.version(VersionInfo.SDK_VERSION).name("PAGINATED").build());
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration()
.map(c -> c.toBuilder().applyMutation(userAgentApplier).build())
.orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build()));
return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
}