software.amazon.awssdk.services.route53recoveryreadiness.DefaultRoute53RecoveryReadinessAsyncClient Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.route53recoveryreadiness;
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.route53recoveryreadiness.model.AccessDeniedException;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ConflictException;
import software.amazon.awssdk.services.route53recoveryreadiness.model.CreateCellRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.CreateCellResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.CreateCrossAccountAuthorizationRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.CreateCrossAccountAuthorizationResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.CreateReadinessCheckRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.CreateReadinessCheckResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.CreateRecoveryGroupRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.CreateRecoveryGroupResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.CreateResourceSetRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.CreateResourceSetResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.DeleteCellRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.DeleteCellResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.DeleteCrossAccountAuthorizationRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.DeleteCrossAccountAuthorizationResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.DeleteReadinessCheckRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.DeleteReadinessCheckResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.DeleteRecoveryGroupRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.DeleteRecoveryGroupResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.DeleteResourceSetRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.DeleteResourceSetResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetArchitectureRecommendationsRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetArchitectureRecommendationsResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetCellReadinessSummaryRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetCellReadinessSummaryResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetCellRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetCellResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckResourceStatusRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckResourceStatusResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckStatusRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckStatusResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetRecoveryGroupReadinessSummaryRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetRecoveryGroupReadinessSummaryResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetRecoveryGroupRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetRecoveryGroupResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetResourceSetRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.GetResourceSetResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.InternalServerException;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListCellsRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListCellsResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListCrossAccountAuthorizationsRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListCrossAccountAuthorizationsResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListReadinessChecksRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListReadinessChecksResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListRecoveryGroupsRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListRecoveryGroupsResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListResourceSetsRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListResourceSetsResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListRulesRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListRulesResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListTagsForResourcesRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ListTagsForResourcesResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ResourceNotFoundException;
import software.amazon.awssdk.services.route53recoveryreadiness.model.Route53RecoveryReadinessException;
import software.amazon.awssdk.services.route53recoveryreadiness.model.Route53RecoveryReadinessRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.TagResourceRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.TagResourceResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ThrottlingException;
import software.amazon.awssdk.services.route53recoveryreadiness.model.UntagResourceRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.UntagResourceResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.UpdateCellRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.UpdateCellResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.UpdateReadinessCheckRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.UpdateReadinessCheckResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.UpdateRecoveryGroupRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.UpdateRecoveryGroupResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.UpdateResourceSetRequest;
import software.amazon.awssdk.services.route53recoveryreadiness.model.UpdateResourceSetResponse;
import software.amazon.awssdk.services.route53recoveryreadiness.model.ValidationException;
import software.amazon.awssdk.services.route53recoveryreadiness.paginators.GetCellReadinessSummaryPublisher;
import software.amazon.awssdk.services.route53recoveryreadiness.paginators.GetReadinessCheckResourceStatusPublisher;
import software.amazon.awssdk.services.route53recoveryreadiness.paginators.GetReadinessCheckStatusPublisher;
import software.amazon.awssdk.services.route53recoveryreadiness.paginators.GetRecoveryGroupReadinessSummaryPublisher;
import software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListCellsPublisher;
import software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListCrossAccountAuthorizationsPublisher;
import software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListReadinessChecksPublisher;
import software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListRecoveryGroupsPublisher;
import software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListResourceSetsPublisher;
import software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListRulesPublisher;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.CreateCellRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.CreateCrossAccountAuthorizationRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.CreateReadinessCheckRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.CreateRecoveryGroupRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.CreateResourceSetRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.DeleteCellRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.DeleteCrossAccountAuthorizationRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.DeleteReadinessCheckRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.DeleteRecoveryGroupRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.DeleteResourceSetRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.GetArchitectureRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.GetCellReadinessSummaryRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.GetCellRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.GetReadinessCheckRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.GetReadinessCheckResourceStatusRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.GetReadinessCheckStatusRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.GetRecoveryGroupReadinessSummaryRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.GetRecoveryGroupRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.GetResourceSetRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.ListCellsRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.ListCrossAccountAuthorizationsRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.ListReadinessChecksRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.ListRecoveryGroupsRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.ListResourceSetsRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.ListRulesRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.ListTagsForResourcesRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.UpdateCellRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.UpdateReadinessCheckRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.UpdateRecoveryGroupRequestMarshaller;
import software.amazon.awssdk.services.route53recoveryreadiness.transform.UpdateResourceSetRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link Route53RecoveryReadinessAsyncClient}.
*
* @see Route53RecoveryReadinessAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultRoute53RecoveryReadinessAsyncClient implements Route53RecoveryReadinessAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultRoute53RecoveryReadinessAsyncClient.class);
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultRoute53RecoveryReadinessAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Creates a cell in an account.
*
*
* @param createCellRequest
* @return A Java Future containing the result of the CreateCell operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - ConflictException 409 response - Conflict exception. You might be using a predefined variable.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.CreateCell
* @see AWS API Documentation
*/
@Override
public CompletableFuture createCell(CreateCellRequest createCellRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createCellRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateCell");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateCellResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("CreateCell")
.withMarshaller(new CreateCellRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createCellRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a cross-account readiness authorization. This lets you authorize another account to work with Route 53
* Application Recovery Controller, for example, to check the readiness status of resources in a separate account.
*
*
* @param createCrossAccountAuthorizationRequest
* @return A Java Future containing the result of the CreateCrossAccountAuthorization operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - ConflictException 409 response - Conflict exception. You might be using a predefined variable.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.CreateCrossAccountAuthorization
* @see AWS API Documentation
*/
@Override
public CompletableFuture createCrossAccountAuthorization(
CreateCrossAccountAuthorizationRequest createCrossAccountAuthorizationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
createCrossAccountAuthorizationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateCrossAccountAuthorization");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateCrossAccountAuthorizationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateCrossAccountAuthorization")
.withMarshaller(new CreateCrossAccountAuthorizationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createCrossAccountAuthorizationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a readiness check in an account. A readiness check monitors a resource set in your application, such as a
* set of Amazon Aurora instances, that Application Recovery Controller is auditing recovery readiness for. The
* audits run once every minute on every resource that's associated with a readiness check.
*
*
* @param createReadinessCheckRequest
* @return A Java Future containing the result of the CreateReadinessCheck operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - ConflictException 409 response - Conflict exception. You might be using a predefined variable.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.CreateReadinessCheck
* @see AWS API Documentation
*/
@Override
public CompletableFuture createReadinessCheck(
CreateReadinessCheckRequest createReadinessCheckRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createReadinessCheckRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateReadinessCheck");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateReadinessCheckResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateReadinessCheck")
.withMarshaller(new CreateReadinessCheckRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createReadinessCheckRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a recovery group in an account. A recovery group corresponds to an application and includes a list of the
* cells that make up the application.
*
*
* @param createRecoveryGroupRequest
* @return A Java Future containing the result of the CreateRecoveryGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - ConflictException 409 response - Conflict exception. You might be using a predefined variable.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.CreateRecoveryGroup
* @see AWS API Documentation
*/
@Override
public CompletableFuture createRecoveryGroup(
CreateRecoveryGroupRequest createRecoveryGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createRecoveryGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateRecoveryGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateRecoveryGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateRecoveryGroup")
.withMarshaller(new CreateRecoveryGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createRecoveryGroupRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a resource set. A resource set is a set of resources of one type that span multiple cells. You can
* associate a resource set with a readiness check to monitor the resources for failover readiness.
*
*
* @param createResourceSetRequest
* @return A Java Future containing the result of the CreateResourceSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - ConflictException 409 response - Conflict exception. You might be using a predefined variable.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.CreateResourceSet
* @see AWS API Documentation
*/
@Override
public CompletableFuture createResourceSet(CreateResourceSetRequest createResourceSetRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createResourceSetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateResourceSet");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateResourceSetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateResourceSet")
.withMarshaller(new CreateResourceSetRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createResourceSetRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Delete a cell. When successful, the response code is 204, with no response body.
*
*
* @param deleteCellRequest
* @return A Java Future containing the result of the DeleteCell operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.DeleteCell
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteCell(DeleteCellRequest deleteCellRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteCellRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteCell");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteCellResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("DeleteCell")
.withMarshaller(new DeleteCellRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteCellRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes cross account readiness authorization.
*
*
* @param deleteCrossAccountAuthorizationRequest
* @return A Java Future containing the result of the DeleteCrossAccountAuthorization operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.DeleteCrossAccountAuthorization
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteCrossAccountAuthorization(
DeleteCrossAccountAuthorizationRequest deleteCrossAccountAuthorizationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteCrossAccountAuthorizationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteCrossAccountAuthorization");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteCrossAccountAuthorizationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteCrossAccountAuthorization")
.withMarshaller(new DeleteCrossAccountAuthorizationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteCrossAccountAuthorizationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes a readiness check.
*
*
* @param deleteReadinessCheckRequest
* @return A Java Future containing the result of the DeleteReadinessCheck operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.DeleteReadinessCheck
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteReadinessCheck(
DeleteReadinessCheckRequest deleteReadinessCheckRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteReadinessCheckRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteReadinessCheck");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteReadinessCheckResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteReadinessCheck")
.withMarshaller(new DeleteReadinessCheckRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteReadinessCheckRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes a recovery group.
*
*
* @param deleteRecoveryGroupRequest
* @return A Java Future containing the result of the DeleteRecoveryGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.DeleteRecoveryGroup
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteRecoveryGroup(
DeleteRecoveryGroupRequest deleteRecoveryGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRecoveryGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRecoveryGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteRecoveryGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteRecoveryGroup")
.withMarshaller(new DeleteRecoveryGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteRecoveryGroupRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes a resource set.
*
*
* @param deleteResourceSetRequest
* @return A Java Future containing the result of the DeleteResourceSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.DeleteResourceSet
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteResourceSet(DeleteResourceSetRequest deleteResourceSetRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteResourceSetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteResourceSet");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteResourceSetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteResourceSet")
.withMarshaller(new DeleteResourceSetRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteResourceSetRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets recommendations about architecture designs for improving resiliency for an application, based on a recovery
* group.
*
*
* @param getArchitectureRecommendationsRequest
* @return A Java Future containing the result of the GetArchitectureRecommendations operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetArchitectureRecommendations
* @see AWS API Documentation
*/
@Override
public CompletableFuture getArchitectureRecommendations(
GetArchitectureRecommendationsRequest getArchitectureRecommendationsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getArchitectureRecommendationsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetArchitectureRecommendations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetArchitectureRecommendationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetArchitectureRecommendations")
.withMarshaller(new GetArchitectureRecommendationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getArchitectureRecommendationsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets information about a cell including cell name, cell Amazon Resource Name (ARN), ARNs of nested cells for this
* cell, and a list of those cell ARNs with their associated recovery group ARNs.
*
*
* @param getCellRequest
* @return A Java Future containing the result of the GetCell operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetCell
* @see AWS API Documentation
*/
@Override
public CompletableFuture getCell(GetCellRequest getCellRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getCellRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetCell");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetCellResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("GetCell")
.withMarshaller(new GetCellRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.withInput(getCellRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets readiness for a cell. Aggregates the readiness of all the resources that are associated with the cell into a
* single value.
*
*
* @param getCellReadinessSummaryRequest
* @return A Java Future containing the result of the GetCellReadinessSummary operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetCellReadinessSummary
* @see AWS API Documentation
*/
@Override
public CompletableFuture getCellReadinessSummary(
GetCellReadinessSummaryRequest getCellReadinessSummaryRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getCellReadinessSummaryRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetCellReadinessSummary");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetCellReadinessSummaryResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetCellReadinessSummary")
.withMarshaller(new GetCellReadinessSummaryRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getCellReadinessSummaryRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets readiness for a cell. Aggregates the readiness of all the resources that are associated with the cell into a
* single value.
*
*
*
* This is a variant of
* {@link #getCellReadinessSummary(software.amazon.awssdk.services.route53recoveryreadiness.model.GetCellReadinessSummaryRequest)}
* 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.route53recoveryreadiness.paginators.GetCellReadinessSummaryPublisher publisher = client.getCellReadinessSummaryPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.route53recoveryreadiness.paginators.GetCellReadinessSummaryPublisher publisher = client.getCellReadinessSummaryPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.route53recoveryreadiness.model.GetCellReadinessSummaryResponse 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 #getCellReadinessSummary(software.amazon.awssdk.services.route53recoveryreadiness.model.GetCellReadinessSummaryRequest)}
* operation.
*
*
* @param getCellReadinessSummaryRequest
* @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.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetCellReadinessSummary
* @see AWS API Documentation
*/
public GetCellReadinessSummaryPublisher getCellReadinessSummaryPaginator(
GetCellReadinessSummaryRequest getCellReadinessSummaryRequest) {
return new GetCellReadinessSummaryPublisher(this, applyPaginatorUserAgent(getCellReadinessSummaryRequest));
}
/**
*
* Gets details about a readiness check.
*
*
* @param getReadinessCheckRequest
* @return A Java Future containing the result of the GetReadinessCheck operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetReadinessCheck
* @see AWS API Documentation
*/
@Override
public CompletableFuture getReadinessCheck(GetReadinessCheckRequest getReadinessCheckRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getReadinessCheckRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetReadinessCheck");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetReadinessCheckResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetReadinessCheck")
.withMarshaller(new GetReadinessCheckRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getReadinessCheckRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets individual readiness status for a readiness check. To see the overall readiness status for a recovery group,
* that considers the readiness status for all the readiness checks in the recovery group, use
* GetRecoveryGroupReadinessSummary.
*
*
* @param getReadinessCheckResourceStatusRequest
* @return A Java Future containing the result of the GetReadinessCheckResourceStatus operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetReadinessCheckResourceStatus
* @see AWS API Documentation
*/
@Override
public CompletableFuture getReadinessCheckResourceStatus(
GetReadinessCheckResourceStatusRequest getReadinessCheckResourceStatusRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getReadinessCheckResourceStatusRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetReadinessCheckResourceStatus");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetReadinessCheckResourceStatusResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetReadinessCheckResourceStatus")
.withMarshaller(new GetReadinessCheckResourceStatusRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getReadinessCheckResourceStatusRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets individual readiness status for a readiness check. To see the overall readiness status for a recovery group,
* that considers the readiness status for all the readiness checks in the recovery group, use
* GetRecoveryGroupReadinessSummary.
*
*
*
* This is a variant of
* {@link #getReadinessCheckResourceStatus(software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckResourceStatusRequest)}
* 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.route53recoveryreadiness.paginators.GetReadinessCheckResourceStatusPublisher publisher = client.getReadinessCheckResourceStatusPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.route53recoveryreadiness.paginators.GetReadinessCheckResourceStatusPublisher publisher = client.getReadinessCheckResourceStatusPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckResourceStatusResponse 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 #getReadinessCheckResourceStatus(software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckResourceStatusRequest)}
* operation.
*
*
* @param getReadinessCheckResourceStatusRequest
* @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.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetReadinessCheckResourceStatus
* @see AWS API Documentation
*/
public GetReadinessCheckResourceStatusPublisher getReadinessCheckResourceStatusPaginator(
GetReadinessCheckResourceStatusRequest getReadinessCheckResourceStatusRequest) {
return new GetReadinessCheckResourceStatusPublisher(this, applyPaginatorUserAgent(getReadinessCheckResourceStatusRequest));
}
/**
*
* Gets the readiness status for an individual readiness check. To see the overall readiness status for a recovery
* group, that considers the readiness status for all the readiness checks in a recovery group, use
* GetRecoveryGroupReadinessSummary.
*
*
* @param getReadinessCheckStatusRequest
* @return A Java Future containing the result of the GetReadinessCheckStatus operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetReadinessCheckStatus
* @see AWS API Documentation
*/
@Override
public CompletableFuture getReadinessCheckStatus(
GetReadinessCheckStatusRequest getReadinessCheckStatusRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getReadinessCheckStatusRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetReadinessCheckStatus");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetReadinessCheckStatusResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetReadinessCheckStatus")
.withMarshaller(new GetReadinessCheckStatusRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getReadinessCheckStatusRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the readiness status for an individual readiness check. To see the overall readiness status for a recovery
* group, that considers the readiness status for all the readiness checks in a recovery group, use
* GetRecoveryGroupReadinessSummary.
*
*
*
* This is a variant of
* {@link #getReadinessCheckStatus(software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckStatusRequest)}
* 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.route53recoveryreadiness.paginators.GetReadinessCheckStatusPublisher publisher = client.getReadinessCheckStatusPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.route53recoveryreadiness.paginators.GetReadinessCheckStatusPublisher publisher = client.getReadinessCheckStatusPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckStatusResponse 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 #getReadinessCheckStatus(software.amazon.awssdk.services.route53recoveryreadiness.model.GetReadinessCheckStatusRequest)}
* operation.
*
*
* @param getReadinessCheckStatusRequest
* @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.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetReadinessCheckStatus
* @see AWS API Documentation
*/
public GetReadinessCheckStatusPublisher getReadinessCheckStatusPaginator(
GetReadinessCheckStatusRequest getReadinessCheckStatusRequest) {
return new GetReadinessCheckStatusPublisher(this, applyPaginatorUserAgent(getReadinessCheckStatusRequest));
}
/**
*
* Gets details about a recovery group, including a list of the cells that are included in it.
*
*
* @param getRecoveryGroupRequest
* @return A Java Future containing the result of the GetRecoveryGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetRecoveryGroup
* @see AWS API Documentation
*/
@Override
public CompletableFuture getRecoveryGroup(GetRecoveryGroupRequest getRecoveryGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getRecoveryGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRecoveryGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetRecoveryGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetRecoveryGroup")
.withMarshaller(new GetRecoveryGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getRecoveryGroupRequest));
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);
}
}
/**
*
* Displays a summary of information about a recovery group's readiness status. Includes the readiness checks for
* resources in the recovery group and the readiness status of each one.
*
*
* @param getRecoveryGroupReadinessSummaryRequest
* @return A Java Future containing the result of the GetRecoveryGroupReadinessSummary operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetRecoveryGroupReadinessSummary
* @see AWS API Documentation
*/
@Override
public CompletableFuture getRecoveryGroupReadinessSummary(
GetRecoveryGroupReadinessSummaryRequest getRecoveryGroupReadinessSummaryRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getRecoveryGroupReadinessSummaryRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRecoveryGroupReadinessSummary");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, GetRecoveryGroupReadinessSummaryResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetRecoveryGroupReadinessSummary")
.withMarshaller(new GetRecoveryGroupReadinessSummaryRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getRecoveryGroupReadinessSummaryRequest));
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);
}
}
/**
*
* Displays a summary of information about a recovery group's readiness status. Includes the readiness checks for
* resources in the recovery group and the readiness status of each one.
*
*
*
* This is a variant of
* {@link #getRecoveryGroupReadinessSummary(software.amazon.awssdk.services.route53recoveryreadiness.model.GetRecoveryGroupReadinessSummaryRequest)}
* 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.route53recoveryreadiness.paginators.GetRecoveryGroupReadinessSummaryPublisher publisher = client.getRecoveryGroupReadinessSummaryPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.route53recoveryreadiness.paginators.GetRecoveryGroupReadinessSummaryPublisher publisher = client.getRecoveryGroupReadinessSummaryPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.route53recoveryreadiness.model.GetRecoveryGroupReadinessSummaryResponse 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 #getRecoveryGroupReadinessSummary(software.amazon.awssdk.services.route53recoveryreadiness.model.GetRecoveryGroupReadinessSummaryRequest)}
* operation.
*
*
* @param getRecoveryGroupReadinessSummaryRequest
* @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.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetRecoveryGroupReadinessSummary
* @see AWS API Documentation
*/
public GetRecoveryGroupReadinessSummaryPublisher getRecoveryGroupReadinessSummaryPaginator(
GetRecoveryGroupReadinessSummaryRequest getRecoveryGroupReadinessSummaryRequest) {
return new GetRecoveryGroupReadinessSummaryPublisher(this,
applyPaginatorUserAgent(getRecoveryGroupReadinessSummaryRequest));
}
/**
*
* Displays the details about a resource set, including a list of the resources in the set.
*
*
* @param getResourceSetRequest
* @return A Java Future containing the result of the GetResourceSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.GetResourceSet
* @see AWS API Documentation
*/
@Override
public CompletableFuture getResourceSet(GetResourceSetRequest getResourceSetRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getResourceSetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetResourceSet");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetResourceSetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetResourceSet")
.withMarshaller(new GetResourceSetRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getResourceSetRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists the cells for an account.
*
*
* @param listCellsRequest
* @return A Java Future containing the result of the ListCells operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListCells
* @see AWS API Documentation
*/
@Override
public CompletableFuture listCells(ListCellsRequest listCellsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listCellsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListCells");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListCellsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("ListCells")
.withMarshaller(new ListCellsRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.withInput(listCellsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists the cells for an account.
*
*
*
* This is a variant of
* {@link #listCells(software.amazon.awssdk.services.route53recoveryreadiness.model.ListCellsRequest)} 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.route53recoveryreadiness.paginators.ListCellsPublisher publisher = client.listCellsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListCellsPublisher publisher = client.listCellsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.route53recoveryreadiness.model.ListCellsResponse 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 #listCells(software.amazon.awssdk.services.route53recoveryreadiness.model.ListCellsRequest)}
* operation.
*
*
* @param listCellsRequest
* @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.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListCells
* @see AWS API Documentation
*/
public ListCellsPublisher listCellsPaginator(ListCellsRequest listCellsRequest) {
return new ListCellsPublisher(this, applyPaginatorUserAgent(listCellsRequest));
}
/**
*
* Lists the cross-account readiness authorizations that are in place for an account.
*
*
* @param listCrossAccountAuthorizationsRequest
* @return A Java Future containing the result of the ListCrossAccountAuthorizations operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListCrossAccountAuthorizations
* @see AWS API Documentation
*/
@Override
public CompletableFuture listCrossAccountAuthorizations(
ListCrossAccountAuthorizationsRequest listCrossAccountAuthorizationsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
listCrossAccountAuthorizationsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListCrossAccountAuthorizations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListCrossAccountAuthorizationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListCrossAccountAuthorizations")
.withMarshaller(new ListCrossAccountAuthorizationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listCrossAccountAuthorizationsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists the cross-account readiness authorizations that are in place for an account.
*
*
*
* This is a variant of
* {@link #listCrossAccountAuthorizations(software.amazon.awssdk.services.route53recoveryreadiness.model.ListCrossAccountAuthorizationsRequest)}
* 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.route53recoveryreadiness.paginators.ListCrossAccountAuthorizationsPublisher publisher = client.listCrossAccountAuthorizationsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListCrossAccountAuthorizationsPublisher publisher = client.listCrossAccountAuthorizationsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.route53recoveryreadiness.model.ListCrossAccountAuthorizationsResponse 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 #listCrossAccountAuthorizations(software.amazon.awssdk.services.route53recoveryreadiness.model.ListCrossAccountAuthorizationsRequest)}
* operation.
*
*
* @param listCrossAccountAuthorizationsRequest
* @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.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListCrossAccountAuthorizations
* @see AWS API Documentation
*/
public ListCrossAccountAuthorizationsPublisher listCrossAccountAuthorizationsPaginator(
ListCrossAccountAuthorizationsRequest listCrossAccountAuthorizationsRequest) {
return new ListCrossAccountAuthorizationsPublisher(this, applyPaginatorUserAgent(listCrossAccountAuthorizationsRequest));
}
/**
*
* Lists the readiness checks for an account.
*
*
* @param listReadinessChecksRequest
* @return A Java Future containing the result of the ListReadinessChecks operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListReadinessChecks
* @see AWS API Documentation
*/
@Override
public CompletableFuture listReadinessChecks(
ListReadinessChecksRequest listReadinessChecksRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listReadinessChecksRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListReadinessChecks");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListReadinessChecksResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListReadinessChecks")
.withMarshaller(new ListReadinessChecksRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listReadinessChecksRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists the readiness checks for an account.
*
*
*
* This is a variant of
* {@link #listReadinessChecks(software.amazon.awssdk.services.route53recoveryreadiness.model.ListReadinessChecksRequest)}
* 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.route53recoveryreadiness.paginators.ListReadinessChecksPublisher publisher = client.listReadinessChecksPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListReadinessChecksPublisher publisher = client.listReadinessChecksPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.route53recoveryreadiness.model.ListReadinessChecksResponse 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 #listReadinessChecks(software.amazon.awssdk.services.route53recoveryreadiness.model.ListReadinessChecksRequest)}
* operation.
*
*
* @param listReadinessChecksRequest
* @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.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListReadinessChecks
* @see AWS API Documentation
*/
public ListReadinessChecksPublisher listReadinessChecksPaginator(ListReadinessChecksRequest listReadinessChecksRequest) {
return new ListReadinessChecksPublisher(this, applyPaginatorUserAgent(listReadinessChecksRequest));
}
/**
*
* Lists the recovery groups in an account.
*
*
* @param listRecoveryGroupsRequest
* @return A Java Future containing the result of the ListRecoveryGroups operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListRecoveryGroups
* @see AWS API Documentation
*/
@Override
public CompletableFuture listRecoveryGroups(ListRecoveryGroupsRequest listRecoveryGroupsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listRecoveryGroupsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRecoveryGroups");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListRecoveryGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListRecoveryGroups")
.withMarshaller(new ListRecoveryGroupsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listRecoveryGroupsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists the recovery groups in an account.
*
*
*
* This is a variant of
* {@link #listRecoveryGroups(software.amazon.awssdk.services.route53recoveryreadiness.model.ListRecoveryGroupsRequest)}
* 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.route53recoveryreadiness.paginators.ListRecoveryGroupsPublisher publisher = client.listRecoveryGroupsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListRecoveryGroupsPublisher publisher = client.listRecoveryGroupsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.route53recoveryreadiness.model.ListRecoveryGroupsResponse 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 #listRecoveryGroups(software.amazon.awssdk.services.route53recoveryreadiness.model.ListRecoveryGroupsRequest)}
* operation.
*
*
* @param listRecoveryGroupsRequest
* @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.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListRecoveryGroups
* @see AWS API Documentation
*/
public ListRecoveryGroupsPublisher listRecoveryGroupsPaginator(ListRecoveryGroupsRequest listRecoveryGroupsRequest) {
return new ListRecoveryGroupsPublisher(this, applyPaginatorUserAgent(listRecoveryGroupsRequest));
}
/**
*
* Lists the resource sets in an account.
*
*
* @param listResourceSetsRequest
* @return A Java Future containing the result of the ListResourceSets operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListResourceSets
* @see AWS API Documentation
*/
@Override
public CompletableFuture listResourceSets(ListResourceSetsRequest listResourceSetsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listResourceSetsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListResourceSets");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListResourceSetsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListResourceSets")
.withMarshaller(new ListResourceSetsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listResourceSetsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists the resource sets in an account.
*
*
*
* This is a variant of
* {@link #listResourceSets(software.amazon.awssdk.services.route53recoveryreadiness.model.ListResourceSetsRequest)}
* 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.route53recoveryreadiness.paginators.ListResourceSetsPublisher publisher = client.listResourceSetsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListResourceSetsPublisher publisher = client.listResourceSetsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.route53recoveryreadiness.model.ListResourceSetsResponse 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 #listResourceSets(software.amazon.awssdk.services.route53recoveryreadiness.model.ListResourceSetsRequest)}
* operation.
*
*
* @param listResourceSetsRequest
* @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.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListResourceSets
* @see AWS API Documentation
*/
public ListResourceSetsPublisher listResourceSetsPaginator(ListResourceSetsRequest listResourceSetsRequest) {
return new ListResourceSetsPublisher(this, applyPaginatorUserAgent(listResourceSetsRequest));
}
/**
*
* Lists all readiness rules, or lists the readiness rules for a specific resource type.
*
*
* @param listRulesRequest
* @return A Java Future containing the result of the ListRules operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListRules
* @see AWS API Documentation
*/
@Override
public CompletableFuture listRules(ListRulesRequest listRulesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listRulesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRules");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListRulesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("ListRules")
.withMarshaller(new ListRulesRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.withInput(listRulesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists all readiness rules, or lists the readiness rules for a specific resource type.
*
*
*
* This is a variant of
* {@link #listRules(software.amazon.awssdk.services.route53recoveryreadiness.model.ListRulesRequest)} 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.route53recoveryreadiness.paginators.ListRulesPublisher publisher = client.listRulesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.route53recoveryreadiness.paginators.ListRulesPublisher publisher = client.listRulesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.route53recoveryreadiness.model.ListRulesResponse 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 #listRules(software.amazon.awssdk.services.route53recoveryreadiness.model.ListRulesRequest)}
* operation.
*
*
* @param listRulesRequest
* @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.
*
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListRules
* @see AWS API Documentation
*/
public ListRulesPublisher listRulesPaginator(ListRulesRequest listRulesRequest) {
return new ListRulesPublisher(this, applyPaginatorUserAgent(listRulesRequest));
}
/**
*
* Lists the tags for a resource.
*
*
* @param listTagsForResourcesRequest
* @return A Java Future containing the result of the ListTagsForResources operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.ListTagsForResources
* @see AWS API Documentation
*/
@Override
public CompletableFuture listTagsForResources(
ListTagsForResourcesRequest listTagsForResourcesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResources");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResources")
.withMarshaller(new ListTagsForResourcesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listTagsForResourcesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Adds a tag to a resource.
*
*
* @param tagResourceRequest
* @return A Java Future containing the result of the TagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.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, "Route53 Recovery Readiness");
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);
}
}
/**
*
* Removes a tag from a 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 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.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, "Route53 Recovery Readiness");
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);
}
}
/**
*
* Updates a cell to replace the list of nested cells with a new list of nested cells.
*
*
* @param updateCellRequest
* @return A Java Future containing the result of the UpdateCell operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.UpdateCell
* @see AWS API Documentation
*/
@Override
public CompletableFuture updateCell(UpdateCellRequest updateCellRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateCellRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateCell");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateCellResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("UpdateCell")
.withMarshaller(new UpdateCellRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateCellRequest));
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);
}
}
/**
*
* Updates a readiness check.
*
*
* @param updateReadinessCheckRequest
* Name of a readiness check to describe.
* @return A Java Future containing the result of the UpdateReadinessCheck operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.UpdateReadinessCheck
* @see AWS API Documentation
*/
@Override
public CompletableFuture updateReadinessCheck(
UpdateReadinessCheckRequest updateReadinessCheckRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateReadinessCheckRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateReadinessCheck");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateReadinessCheckResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateReadinessCheck")
.withMarshaller(new UpdateReadinessCheckRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateReadinessCheckRequest));
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);
}
}
/**
*
* Updates a recovery group.
*
*
* @param updateRecoveryGroupRequest
* Name of a recovery group.
* @return A Java Future containing the result of the UpdateRecoveryGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.UpdateRecoveryGroup
* @see AWS API Documentation
*/
@Override
public CompletableFuture updateRecoveryGroup(
UpdateRecoveryGroupRequest updateRecoveryGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateRecoveryGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateRecoveryGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateRecoveryGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateRecoveryGroup")
.withMarshaller(new UpdateRecoveryGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateRecoveryGroupRequest));
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);
}
}
/**
*
* Updates a resource set.
*
*
* @param updateResourceSetRequest
* Name of a resource set.
* @return A Java Future containing the result of the UpdateResourceSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException 404 response - Malformed query string. The query string contains a syntax
* error or resource not found.
* - ThrottlingException 429 response - Limit exceeded exception or too many requests exception.
* - ValidationException 400 response - Multiple causes. For example, you might have a malformed query
* string, an input parameter might be out of range, or you used parameters together incorrectly.
* - InternalServerException 500 response - Internal service error or temporary service error. Retry the
* request.
* - AccessDeniedException 403 response - Access denied exception. You do not have sufficient access to
* perform this action.
* - 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.
* - Route53RecoveryReadinessException Base class for all service exceptions. Unknown exceptions will be
* thrown as an instance of this type.
*
* @sample Route53RecoveryReadinessAsyncClient.UpdateResourceSet
* @see AWS API Documentation
*/
@Override
public CompletableFuture updateResourceSet(UpdateResourceSetRequest updateResourceSetRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateResourceSetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Route53 Recovery Readiness");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateResourceSet");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateResourceSetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateResourceSet")
.withMarshaller(new UpdateResourceSetRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateResourceSetRequest));
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(Route53RecoveryReadinessException::builder)
.protocol(AwsJsonProtocol.REST_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccessDeniedException")
.exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(403).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConflictException")
.exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ThrottlingException")
.exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ValidationException")
.exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServerException")
.exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build());
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
}
if (publishers == null || publishers.isEmpty()) {
publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
}
if (publishers == null) {
publishers = Collections.emptyList();
}
return publishers;
}
private 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);
}
}