
software.amazon.awssdk.services.dax.DefaultDaxAsyncClient 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.dax;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
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.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.dax.model.ClusterAlreadyExistsException;
import software.amazon.awssdk.services.dax.model.ClusterNotFoundException;
import software.amazon.awssdk.services.dax.model.ClusterQuotaForCustomerExceededException;
import software.amazon.awssdk.services.dax.model.CreateClusterRequest;
import software.amazon.awssdk.services.dax.model.CreateClusterResponse;
import software.amazon.awssdk.services.dax.model.CreateParameterGroupRequest;
import software.amazon.awssdk.services.dax.model.CreateParameterGroupResponse;
import software.amazon.awssdk.services.dax.model.CreateSubnetGroupRequest;
import software.amazon.awssdk.services.dax.model.CreateSubnetGroupResponse;
import software.amazon.awssdk.services.dax.model.DaxException;
import software.amazon.awssdk.services.dax.model.DecreaseReplicationFactorRequest;
import software.amazon.awssdk.services.dax.model.DecreaseReplicationFactorResponse;
import software.amazon.awssdk.services.dax.model.DeleteClusterRequest;
import software.amazon.awssdk.services.dax.model.DeleteClusterResponse;
import software.amazon.awssdk.services.dax.model.DeleteParameterGroupRequest;
import software.amazon.awssdk.services.dax.model.DeleteParameterGroupResponse;
import software.amazon.awssdk.services.dax.model.DeleteSubnetGroupRequest;
import software.amazon.awssdk.services.dax.model.DeleteSubnetGroupResponse;
import software.amazon.awssdk.services.dax.model.DescribeClustersRequest;
import software.amazon.awssdk.services.dax.model.DescribeClustersResponse;
import software.amazon.awssdk.services.dax.model.DescribeDefaultParametersRequest;
import software.amazon.awssdk.services.dax.model.DescribeDefaultParametersResponse;
import software.amazon.awssdk.services.dax.model.DescribeEventsRequest;
import software.amazon.awssdk.services.dax.model.DescribeEventsResponse;
import software.amazon.awssdk.services.dax.model.DescribeParameterGroupsRequest;
import software.amazon.awssdk.services.dax.model.DescribeParameterGroupsResponse;
import software.amazon.awssdk.services.dax.model.DescribeParametersRequest;
import software.amazon.awssdk.services.dax.model.DescribeParametersResponse;
import software.amazon.awssdk.services.dax.model.DescribeSubnetGroupsRequest;
import software.amazon.awssdk.services.dax.model.DescribeSubnetGroupsResponse;
import software.amazon.awssdk.services.dax.model.IncreaseReplicationFactorRequest;
import software.amazon.awssdk.services.dax.model.IncreaseReplicationFactorResponse;
import software.amazon.awssdk.services.dax.model.InsufficientClusterCapacityException;
import software.amazon.awssdk.services.dax.model.InvalidArnException;
import software.amazon.awssdk.services.dax.model.InvalidClusterStateException;
import software.amazon.awssdk.services.dax.model.InvalidParameterCombinationException;
import software.amazon.awssdk.services.dax.model.InvalidParameterGroupStateException;
import software.amazon.awssdk.services.dax.model.InvalidParameterValueException;
import software.amazon.awssdk.services.dax.model.InvalidSubnetException;
import software.amazon.awssdk.services.dax.model.InvalidVpcNetworkStateException;
import software.amazon.awssdk.services.dax.model.ListTagsRequest;
import software.amazon.awssdk.services.dax.model.ListTagsResponse;
import software.amazon.awssdk.services.dax.model.NodeNotFoundException;
import software.amazon.awssdk.services.dax.model.NodeQuotaForClusterExceededException;
import software.amazon.awssdk.services.dax.model.NodeQuotaForCustomerExceededException;
import software.amazon.awssdk.services.dax.model.ParameterGroupAlreadyExistsException;
import software.amazon.awssdk.services.dax.model.ParameterGroupNotFoundException;
import software.amazon.awssdk.services.dax.model.ParameterGroupQuotaExceededException;
import software.amazon.awssdk.services.dax.model.RebootNodeRequest;
import software.amazon.awssdk.services.dax.model.RebootNodeResponse;
import software.amazon.awssdk.services.dax.model.ServiceLinkedRoleNotFoundException;
import software.amazon.awssdk.services.dax.model.SubnetGroupAlreadyExistsException;
import software.amazon.awssdk.services.dax.model.SubnetGroupInUseException;
import software.amazon.awssdk.services.dax.model.SubnetGroupNotFoundException;
import software.amazon.awssdk.services.dax.model.SubnetGroupQuotaExceededException;
import software.amazon.awssdk.services.dax.model.SubnetInUseException;
import software.amazon.awssdk.services.dax.model.SubnetQuotaExceededException;
import software.amazon.awssdk.services.dax.model.TagNotFoundException;
import software.amazon.awssdk.services.dax.model.TagQuotaPerResourceExceededException;
import software.amazon.awssdk.services.dax.model.TagResourceRequest;
import software.amazon.awssdk.services.dax.model.TagResourceResponse;
import software.amazon.awssdk.services.dax.model.UntagResourceRequest;
import software.amazon.awssdk.services.dax.model.UntagResourceResponse;
import software.amazon.awssdk.services.dax.model.UpdateClusterRequest;
import software.amazon.awssdk.services.dax.model.UpdateClusterResponse;
import software.amazon.awssdk.services.dax.model.UpdateParameterGroupRequest;
import software.amazon.awssdk.services.dax.model.UpdateParameterGroupResponse;
import software.amazon.awssdk.services.dax.model.UpdateSubnetGroupRequest;
import software.amazon.awssdk.services.dax.model.UpdateSubnetGroupResponse;
import software.amazon.awssdk.services.dax.transform.CreateClusterRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.CreateParameterGroupRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.CreateSubnetGroupRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.DecreaseReplicationFactorRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.DeleteClusterRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.DeleteParameterGroupRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.DeleteSubnetGroupRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.DescribeClustersRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.DescribeDefaultParametersRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.DescribeEventsRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.DescribeParameterGroupsRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.DescribeParametersRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.DescribeSubnetGroupsRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.IncreaseReplicationFactorRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.ListTagsRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.RebootNodeRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.UpdateClusterRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.UpdateParameterGroupRequestMarshaller;
import software.amazon.awssdk.services.dax.transform.UpdateSubnetGroupRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link DaxAsyncClient}.
*
* @see DaxAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultDaxAsyncClient implements DaxAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultDaxAsyncClient.class);
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultDaxAsyncClient(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 DAX cluster. All nodes in the cluster run the same DAX caching software.
*
*
* @param createClusterRequest
* @return A Java Future containing the result of the CreateCluster operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClusterAlreadyExistsException You already have a DAX cluster with the given identifier.
* - InvalidClusterStateException The requested DAX cluster is not in the available state.
* - InsufficientClusterCapacityException There are not enough system resources to create the cluster you
* requested (or to resize an already-existing cluster).
* - SubnetGroupNotFoundException The requested subnet group name does not refer to an existing subnet
* group.
* - InvalidParameterGroupStateException One or more parameters in a parameter group are in an invalid
* state.
* - ParameterGroupNotFoundException The specified parameter group does not exist.
* - ClusterQuotaForCustomerExceededException You have attempted to exceed the maximum number of DAX
* clusters for your AWS account.
* - NodeQuotaForClusterExceededException You have attempted to exceed the maximum number of nodes for a
* DAX cluster.
* - NodeQuotaForCustomerExceededException You have attempted to exceed the maximum number of nodes for
* your AWS account.
* - InvalidVpcNetworkStateException The VPC network is in an invalid state.
* - TagQuotaPerResourceExceededException You have exceeded the maximum number of tags for this DAX
* cluster.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.CreateCluster
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createCluster(CreateClusterRequest createClusterRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createClusterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateCluster");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateClusterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateCluster")
.withMarshaller(new CreateClusterRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createClusterRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = createClusterRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a new parameter group. A parameter group is a collection of parameters that you apply to all of the nodes
* in a DAX cluster.
*
*
* @param createParameterGroupRequest
* @return A Java Future containing the result of the CreateParameterGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ParameterGroupQuotaExceededException You have attempted to exceed the maximum number of parameter
* groups.
* - ParameterGroupAlreadyExistsException The specified parameter group already exists.
* - InvalidParameterGroupStateException One or more parameters in a parameter group are in an invalid
* state.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.CreateParameterGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createParameterGroup(
CreateParameterGroupRequest createParameterGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createParameterGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateParameterGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateParameterGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateParameterGroup")
.withMarshaller(new CreateParameterGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createParameterGroupRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = createParameterGroupRequest.overrideConfiguration().orElse(
null);
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a new subnet group.
*
*
* @param createSubnetGroupRequest
* @return A Java Future containing the result of the CreateSubnetGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - SubnetGroupAlreadyExistsException The specified subnet group already exists.
* - SubnetGroupQuotaExceededException The request cannot be processed because it would exceed the allowed
* number of subnets in a subnet group.
* - SubnetQuotaExceededException The request cannot be processed because it would exceed the allowed
* number of subnets in a subnet group.
* - InvalidSubnetException An invalid subnet identifier was specified.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.CreateSubnetGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createSubnetGroup(CreateSubnetGroupRequest createSubnetGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createSubnetGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSubnetGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSubnetGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateSubnetGroup")
.withMarshaller(new CreateSubnetGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createSubnetGroupRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = createSubnetGroupRequest.overrideConfiguration().orElse(null);
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 one or more nodes from a DAX cluster.
*
*
*
* You cannot use DecreaseReplicationFactor
to remove the last node in a DAX cluster. If you need to do
* this, use DeleteCluster
instead.
*
*
*
* @param decreaseReplicationFactorRequest
* @return A Java Future containing the result of the DecreaseReplicationFactor operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClusterNotFoundException The requested cluster ID does not refer to an existing DAX cluster.
* - NodeNotFoundException None of the nodes in the cluster have the given node ID.
* - InvalidClusterStateException The requested DAX cluster is not in the available state.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.DecreaseReplicationFactor
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture decreaseReplicationFactor(
DecreaseReplicationFactorRequest decreaseReplicationFactorRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, decreaseReplicationFactorRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DecreaseReplicationFactor");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DecreaseReplicationFactorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DecreaseReplicationFactor")
.withMarshaller(new DecreaseReplicationFactorRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(decreaseReplicationFactorRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = decreaseReplicationFactorRequest.overrideConfiguration()
.orElse(null);
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 previously provisioned DAX cluster. DeleteCluster deletes all associated nodes, node endpoints
* and the DAX cluster itself. When you receive a successful response from this action, DAX immediately begins
* deleting the cluster; you cannot cancel or revert this action.
*
*
* @param deleteClusterRequest
* @return A Java Future containing the result of the DeleteCluster operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClusterNotFoundException The requested cluster ID does not refer to an existing DAX cluster.
* - InvalidClusterStateException The requested DAX cluster is not in the available state.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.DeleteCluster
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteCluster(DeleteClusterRequest deleteClusterRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteClusterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteCluster");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteClusterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteCluster")
.withMarshaller(new DeleteClusterRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteClusterRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteClusterRequest.overrideConfiguration().orElse(null);
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 the specified parameter group. You cannot delete a parameter group if it is associated with any DAX
* clusters.
*
*
* @param deleteParameterGroupRequest
* @return A Java Future containing the result of the DeleteParameterGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterGroupStateException One or more parameters in a parameter group are in an invalid
* state.
* - ParameterGroupNotFoundException The specified parameter group does not exist.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.DeleteParameterGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteParameterGroup(
DeleteParameterGroupRequest deleteParameterGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteParameterGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteParameterGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteParameterGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteParameterGroup")
.withMarshaller(new DeleteParameterGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteParameterGroupRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteParameterGroupRequest.overrideConfiguration().orElse(
null);
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 subnet group.
*
*
*
* You cannot delete a subnet group if it is associated with any DAX clusters.
*
*
*
* @param deleteSubnetGroupRequest
* @return A Java Future containing the result of the DeleteSubnetGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - SubnetGroupInUseException The specified subnet group is currently in use.
* - SubnetGroupNotFoundException The requested subnet group name does not refer to an existing subnet
* group.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.DeleteSubnetGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteSubnetGroup(DeleteSubnetGroupRequest deleteSubnetGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSubnetGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSubnetGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteSubnetGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteSubnetGroup")
.withMarshaller(new DeleteSubnetGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteSubnetGroupRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteSubnetGroupRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Returns information about all provisioned DAX clusters if no cluster identifier is specified, or about a specific
* DAX cluster if a cluster identifier is supplied.
*
*
* If the cluster is in the CREATING state, only cluster level information will be displayed until all of the nodes
* are successfully provisioned.
*
*
* If the cluster is in the DELETING state, only cluster level information will be displayed.
*
*
* If nodes are currently being added to the DAX cluster, node endpoint information and creation time for the
* additional nodes will not be displayed until they are completely provisioned. When the DAX cluster state is
* available, the cluster is ready for use.
*
*
* If nodes are currently being removed from the DAX cluster, no endpoint information for the removed nodes is
* displayed.
*
*
* @param describeClustersRequest
* @return A Java Future containing the result of the DescribeClusters operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClusterNotFoundException The requested cluster ID does not refer to an existing DAX cluster.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.DescribeClusters
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeClusters(DescribeClustersRequest describeClustersRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeClustersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeClusters");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeClustersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeClusters")
.withMarshaller(new DescribeClustersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeClustersRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeClustersRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Returns the default system parameter information for the DAX caching software.
*
*
* @param describeDefaultParametersRequest
* @return A Java Future containing the result of the DescribeDefaultParameters operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.DescribeDefaultParameters
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture describeDefaultParameters(
DescribeDefaultParametersRequest describeDefaultParametersRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeDefaultParametersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeDefaultParameters");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeDefaultParametersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeDefaultParameters")
.withMarshaller(new DescribeDefaultParametersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeDefaultParametersRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeDefaultParametersRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Returns events related to DAX clusters and parameter groups. You can obtain events specific to a particular DAX
* cluster or parameter group by providing the name as a parameter.
*
*
* By default, only the events occurring within the last 24 hours are returned; however, you can retrieve up to 14
* days' worth of events if necessary.
*
*
* @param describeEventsRequest
* @return A Java Future containing the result of the DescribeEvents operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.DescribeEvents
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeEvents(DescribeEventsRequest describeEventsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEventsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEvents");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeEventsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeEvents")
.withMarshaller(new DescribeEventsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeEventsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeEventsRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Returns a list of parameter group descriptions. If a parameter group name is specified, the list will contain
* only the descriptions for that group.
*
*
* @param describeParameterGroupsRequest
* @return A Java Future containing the result of the DescribeParameterGroups operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ParameterGroupNotFoundException The specified parameter group does not exist.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.DescribeParameterGroups
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture describeParameterGroups(
DescribeParameterGroupsRequest describeParameterGroupsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeParameterGroupsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeParameterGroups");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeParameterGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeParameterGroups")
.withMarshaller(new DescribeParameterGroupsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeParameterGroupsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeParameterGroupsRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Returns the detailed parameter list for a particular parameter group.
*
*
* @param describeParametersRequest
* @return A Java Future containing the result of the DescribeParameters operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ParameterGroupNotFoundException The specified parameter group does not exist.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.DescribeParameters
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeParameters(DescribeParametersRequest describeParametersRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeParametersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeParameters");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeParametersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeParameters")
.withMarshaller(new DescribeParametersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeParametersRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeParametersRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Returns a list of subnet group descriptions. If a subnet group name is specified, the list will contain only the
* description of that group.
*
*
* @param describeSubnetGroupsRequest
* @return A Java Future containing the result of the DescribeSubnetGroups operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - SubnetGroupNotFoundException The requested subnet group name does not refer to an existing subnet
* group.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.DescribeSubnetGroups
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeSubnetGroups(
DescribeSubnetGroupsRequest describeSubnetGroupsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeSubnetGroupsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeSubnetGroups");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeSubnetGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeSubnetGroups")
.withMarshaller(new DescribeSubnetGroupsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeSubnetGroupsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeSubnetGroupsRequest.overrideConfiguration().orElse(
null);
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 one or more nodes to a DAX cluster.
*
*
* @param increaseReplicationFactorRequest
* @return A Java Future containing the result of the IncreaseReplicationFactor operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClusterNotFoundException The requested cluster ID does not refer to an existing DAX cluster.
* - InvalidClusterStateException The requested DAX cluster is not in the available state.
* - InsufficientClusterCapacityException There are not enough system resources to create the cluster you
* requested (or to resize an already-existing cluster).
* - InvalidVpcNetworkStateException The VPC network is in an invalid state.
* - NodeQuotaForClusterExceededException You have attempted to exceed the maximum number of nodes for a
* DAX cluster.
* - NodeQuotaForCustomerExceededException You have attempted to exceed the maximum number of nodes for
* your AWS account.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.IncreaseReplicationFactor
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture increaseReplicationFactor(
IncreaseReplicationFactorRequest increaseReplicationFactorRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, increaseReplicationFactorRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "IncreaseReplicationFactor");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, IncreaseReplicationFactorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("IncreaseReplicationFactor")
.withMarshaller(new IncreaseReplicationFactorRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(increaseReplicationFactorRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = increaseReplicationFactorRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* List all of the tags for a DAX cluster. You can call ListTags
up to 10 times per second, per
* account.
*
*
* @param listTagsRequest
* @return A Java Future containing the result of the ListTags operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClusterNotFoundException The requested cluster ID does not refer to an existing DAX cluster.
* - InvalidArnException The Amazon Resource Name (ARN) supplied in the request is not valid.
* - InvalidClusterStateException The requested DAX cluster is not in the available state.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.ListTags
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listTags(ListTagsRequest listTagsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTags");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListTagsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("ListTags")
.withMarshaller(new ListTagsRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.withInput(listTagsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = listTagsRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
* Reboots a single node of a DAX cluster. The reboot action takes place as soon as possible. During the reboot, the
* node status is set to REBOOTING.
*
*
*
* RebootNode
restarts the DAX engine process and does not remove the contents of the cache.
*
*
*
* @param rebootNodeRequest
* @return A Java Future containing the result of the RebootNode operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClusterNotFoundException The requested cluster ID does not refer to an existing DAX cluster.
* - NodeNotFoundException None of the nodes in the cluster have the given node ID.
* - InvalidClusterStateException The requested DAX cluster is not in the available state.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.RebootNode
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture rebootNode(RebootNodeRequest rebootNodeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, rebootNodeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RebootNode");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
RebootNodeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("RebootNode")
.withMarshaller(new RebootNodeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(rebootNodeRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = rebootNodeRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
* Associates a set of tags with a DAX resource. You can call TagResource
up to 5 times per second, per
* account.
*
*
* @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.
*
* - ClusterNotFoundException The requested cluster ID does not refer to an existing DAX cluster.
* - TagQuotaPerResourceExceededException You have exceeded the maximum number of tags for this DAX
* cluster.
* - InvalidArnException The Amazon Resource Name (ARN) supplied in the request is not valid.
* - InvalidClusterStateException The requested DAX cluster is not in the available state.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.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, "DAX");
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));
AwsRequestOverrideConfiguration requestOverrideConfig = tagResourceRequest.overrideConfiguration().orElse(null);
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 the association of tags from a DAX resource. You can call UntagResource
up to 5 times per
* second, per account.
*
*
* @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.
*
* - ClusterNotFoundException The requested cluster ID does not refer to an existing DAX cluster.
* - InvalidArnException The Amazon Resource Name (ARN) supplied in the request is not valid.
* - TagNotFoundException The tag does not exist.
* - InvalidClusterStateException The requested DAX cluster is not in the available state.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.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, "DAX");
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));
AwsRequestOverrideConfiguration requestOverrideConfig = untagResourceRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
* Modifies the settings for a DAX cluster. You can use this action to change one or more cluster configuration
* parameters by specifying the parameters and the new values.
*
*
* @param updateClusterRequest
* @return A Java Future containing the result of the UpdateCluster operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidClusterStateException The requested DAX cluster is not in the available state.
* - ClusterNotFoundException The requested cluster ID does not refer to an existing DAX cluster.
* - InvalidParameterGroupStateException One or more parameters in a parameter group are in an invalid
* state.
* - ParameterGroupNotFoundException The specified parameter group does not exist.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.UpdateCluster
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture updateCluster(UpdateClusterRequest updateClusterRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateClusterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateCluster");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateClusterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateCluster")
.withMarshaller(new UpdateClusterRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateClusterRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = updateClusterRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
* Modifies the parameters of a parameter group. You can modify up to 20 parameters in a single request by
* submitting a list parameter name and value pairs.
*
*
* @param updateParameterGroupRequest
* @return A Java Future containing the result of the UpdateParameterGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterGroupStateException One or more parameters in a parameter group are in an invalid
* state.
* - ParameterGroupNotFoundException The specified parameter group does not exist.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - InvalidParameterValueException The value for a parameter is invalid.
* - InvalidParameterCombinationException Two or more incompatible parameters were specified.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.UpdateParameterGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture updateParameterGroup(
UpdateParameterGroupRequest updateParameterGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateParameterGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateParameterGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateParameterGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateParameterGroup")
.withMarshaller(new UpdateParameterGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateParameterGroupRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = updateParameterGroupRequest.overrideConfiguration().orElse(
null);
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);
}
}
/**
*
* Modifies an existing subnet group.
*
*
* @param updateSubnetGroupRequest
* @return A Java Future containing the result of the UpdateSubnetGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - SubnetGroupNotFoundException The requested subnet group name does not refer to an existing subnet
* group.
* - SubnetQuotaExceededException The request cannot be processed because it would exceed the allowed
* number of subnets in a subnet group.
* - SubnetInUseException The requested subnet is being used by another subnet group.
* - InvalidSubnetException An invalid subnet identifier was specified.
* - ServiceLinkedRoleNotFoundException The specified service linked role (SLR) was not found.
* - 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.
* - DaxException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
* of this type.
*
* @sample DaxAsyncClient.UpdateSubnetGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture updateSubnetGroup(UpdateSubnetGroupRequest updateSubnetGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateSubnetGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "DAX");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateSubnetGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateSubnetGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateSubnetGroup")
.withMarshaller(new UpdateSubnetGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateSubnetGroupRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = updateSubnetGroupRequest.overrideConfiguration().orElse(null);
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(DaxException::builder)
.protocol(AwsJsonProtocol.AWS_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("SubnetQuotaExceededFault")
.exceptionBuilderSupplier(SubnetQuotaExceededException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("SubnetGroupNotFoundFault")
.exceptionBuilderSupplier(SubnetGroupNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("SubnetGroupQuotaExceededFault")
.exceptionBuilderSupplier(SubnetGroupQuotaExceededException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ParameterGroupAlreadyExistsFault")
.exceptionBuilderSupplier(ParameterGroupAlreadyExistsException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("SubnetInUse")
.exceptionBuilderSupplier(SubnetInUseException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ClusterNotFoundFault")
.exceptionBuilderSupplier(ClusterNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidParameterValueException")
.exceptionBuilderSupplier(InvalidParameterValueException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("NodeNotFoundFault")
.exceptionBuilderSupplier(NodeNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidARNFault")
.exceptionBuilderSupplier(InvalidArnException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidParameterCombinationException")
.exceptionBuilderSupplier(InvalidParameterCombinationException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("NodeQuotaForCustomerExceededFault")
.exceptionBuilderSupplier(NodeQuotaForCustomerExceededException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidClusterStateFault")
.exceptionBuilderSupplier(InvalidClusterStateException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InsufficientClusterCapacityFault")
.exceptionBuilderSupplier(InsufficientClusterCapacityException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("TagNotFoundFault")
.exceptionBuilderSupplier(TagNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidVPCNetworkStateFault")
.exceptionBuilderSupplier(InvalidVpcNetworkStateException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("TagQuotaPerResourceExceeded")
.exceptionBuilderSupplier(TagQuotaPerResourceExceededException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ClusterQuotaForCustomerExceededFault")
.exceptionBuilderSupplier(ClusterQuotaForCustomerExceededException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("SubnetGroupInUseFault")
.exceptionBuilderSupplier(SubnetGroupInUseException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidParameterGroupStateFault")
.exceptionBuilderSupplier(InvalidParameterGroupStateException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ParameterGroupNotFoundFault")
.exceptionBuilderSupplier(ParameterGroupNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidSubnet")
.exceptionBuilderSupplier(InvalidSubnetException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ClusterAlreadyExistsFault")
.exceptionBuilderSupplier(ClusterAlreadyExistsException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ServiceLinkedRoleNotFoundFault")
.exceptionBuilderSupplier(ServiceLinkedRoleNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("NodeQuotaForClusterExceededFault")
.exceptionBuilderSupplier(NodeQuotaForClusterExceededException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ParameterGroupQuotaExceededFault")
.exceptionBuilderSupplier(ParameterGroupQuotaExceededException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("SubnetGroupAlreadyExistsFault")
.exceptionBuilderSupplier(SubnetGroupAlreadyExistsException::builder).build());
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
}
if (publishers == null || publishers.isEmpty()) {
publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
}
if (publishers == null) {
publishers = Collections.emptyList();
}
return publishers;
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
}