software.amazon.awssdk.services.vpclattice.DefaultVpcLatticeAsyncClient Maven / Gradle / Ivy
Show all versions of vpclattice Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.vpclattice;
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.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.awscore.retry.AwsRetryStrategy;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
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.retry.RetryMode;
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.retries.api.RetryStrategy;
import software.amazon.awssdk.services.vpclattice.internal.VpcLatticeServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.vpclattice.model.AccessDeniedException;
import software.amazon.awssdk.services.vpclattice.model.BatchUpdateRuleRequest;
import software.amazon.awssdk.services.vpclattice.model.BatchUpdateRuleResponse;
import software.amazon.awssdk.services.vpclattice.model.ConflictException;
import software.amazon.awssdk.services.vpclattice.model.CreateAccessLogSubscriptionRequest;
import software.amazon.awssdk.services.vpclattice.model.CreateAccessLogSubscriptionResponse;
import software.amazon.awssdk.services.vpclattice.model.CreateListenerRequest;
import software.amazon.awssdk.services.vpclattice.model.CreateListenerResponse;
import software.amazon.awssdk.services.vpclattice.model.CreateRuleRequest;
import software.amazon.awssdk.services.vpclattice.model.CreateRuleResponse;
import software.amazon.awssdk.services.vpclattice.model.CreateServiceNetworkRequest;
import software.amazon.awssdk.services.vpclattice.model.CreateServiceNetworkResponse;
import software.amazon.awssdk.services.vpclattice.model.CreateServiceNetworkServiceAssociationRequest;
import software.amazon.awssdk.services.vpclattice.model.CreateServiceNetworkServiceAssociationResponse;
import software.amazon.awssdk.services.vpclattice.model.CreateServiceNetworkVpcAssociationRequest;
import software.amazon.awssdk.services.vpclattice.model.CreateServiceNetworkVpcAssociationResponse;
import software.amazon.awssdk.services.vpclattice.model.CreateServiceRequest;
import software.amazon.awssdk.services.vpclattice.model.CreateServiceResponse;
import software.amazon.awssdk.services.vpclattice.model.CreateTargetGroupRequest;
import software.amazon.awssdk.services.vpclattice.model.CreateTargetGroupResponse;
import software.amazon.awssdk.services.vpclattice.model.DeleteAccessLogSubscriptionRequest;
import software.amazon.awssdk.services.vpclattice.model.DeleteAccessLogSubscriptionResponse;
import software.amazon.awssdk.services.vpclattice.model.DeleteAuthPolicyRequest;
import software.amazon.awssdk.services.vpclattice.model.DeleteAuthPolicyResponse;
import software.amazon.awssdk.services.vpclattice.model.DeleteListenerRequest;
import software.amazon.awssdk.services.vpclattice.model.DeleteListenerResponse;
import software.amazon.awssdk.services.vpclattice.model.DeleteResourcePolicyRequest;
import software.amazon.awssdk.services.vpclattice.model.DeleteResourcePolicyResponse;
import software.amazon.awssdk.services.vpclattice.model.DeleteRuleRequest;
import software.amazon.awssdk.services.vpclattice.model.DeleteRuleResponse;
import software.amazon.awssdk.services.vpclattice.model.DeleteServiceNetworkRequest;
import software.amazon.awssdk.services.vpclattice.model.DeleteServiceNetworkResponse;
import software.amazon.awssdk.services.vpclattice.model.DeleteServiceNetworkServiceAssociationRequest;
import software.amazon.awssdk.services.vpclattice.model.DeleteServiceNetworkServiceAssociationResponse;
import software.amazon.awssdk.services.vpclattice.model.DeleteServiceNetworkVpcAssociationRequest;
import software.amazon.awssdk.services.vpclattice.model.DeleteServiceNetworkVpcAssociationResponse;
import software.amazon.awssdk.services.vpclattice.model.DeleteServiceRequest;
import software.amazon.awssdk.services.vpclattice.model.DeleteServiceResponse;
import software.amazon.awssdk.services.vpclattice.model.DeleteTargetGroupRequest;
import software.amazon.awssdk.services.vpclattice.model.DeleteTargetGroupResponse;
import software.amazon.awssdk.services.vpclattice.model.DeregisterTargetsRequest;
import software.amazon.awssdk.services.vpclattice.model.DeregisterTargetsResponse;
import software.amazon.awssdk.services.vpclattice.model.GetAccessLogSubscriptionRequest;
import software.amazon.awssdk.services.vpclattice.model.GetAccessLogSubscriptionResponse;
import software.amazon.awssdk.services.vpclattice.model.GetAuthPolicyRequest;
import software.amazon.awssdk.services.vpclattice.model.GetAuthPolicyResponse;
import software.amazon.awssdk.services.vpclattice.model.GetListenerRequest;
import software.amazon.awssdk.services.vpclattice.model.GetListenerResponse;
import software.amazon.awssdk.services.vpclattice.model.GetResourcePolicyRequest;
import software.amazon.awssdk.services.vpclattice.model.GetResourcePolicyResponse;
import software.amazon.awssdk.services.vpclattice.model.GetRuleRequest;
import software.amazon.awssdk.services.vpclattice.model.GetRuleResponse;
import software.amazon.awssdk.services.vpclattice.model.GetServiceNetworkRequest;
import software.amazon.awssdk.services.vpclattice.model.GetServiceNetworkResponse;
import software.amazon.awssdk.services.vpclattice.model.GetServiceNetworkServiceAssociationRequest;
import software.amazon.awssdk.services.vpclattice.model.GetServiceNetworkServiceAssociationResponse;
import software.amazon.awssdk.services.vpclattice.model.GetServiceNetworkVpcAssociationRequest;
import software.amazon.awssdk.services.vpclattice.model.GetServiceNetworkVpcAssociationResponse;
import software.amazon.awssdk.services.vpclattice.model.GetServiceRequest;
import software.amazon.awssdk.services.vpclattice.model.GetServiceResponse;
import software.amazon.awssdk.services.vpclattice.model.GetTargetGroupRequest;
import software.amazon.awssdk.services.vpclattice.model.GetTargetGroupResponse;
import software.amazon.awssdk.services.vpclattice.model.InternalServerException;
import software.amazon.awssdk.services.vpclattice.model.ListAccessLogSubscriptionsRequest;
import software.amazon.awssdk.services.vpclattice.model.ListAccessLogSubscriptionsResponse;
import software.amazon.awssdk.services.vpclattice.model.ListListenersRequest;
import software.amazon.awssdk.services.vpclattice.model.ListListenersResponse;
import software.amazon.awssdk.services.vpclattice.model.ListRulesRequest;
import software.amazon.awssdk.services.vpclattice.model.ListRulesResponse;
import software.amazon.awssdk.services.vpclattice.model.ListServiceNetworkServiceAssociationsRequest;
import software.amazon.awssdk.services.vpclattice.model.ListServiceNetworkServiceAssociationsResponse;
import software.amazon.awssdk.services.vpclattice.model.ListServiceNetworkVpcAssociationsRequest;
import software.amazon.awssdk.services.vpclattice.model.ListServiceNetworkVpcAssociationsResponse;
import software.amazon.awssdk.services.vpclattice.model.ListServiceNetworksRequest;
import software.amazon.awssdk.services.vpclattice.model.ListServiceNetworksResponse;
import software.amazon.awssdk.services.vpclattice.model.ListServicesRequest;
import software.amazon.awssdk.services.vpclattice.model.ListServicesResponse;
import software.amazon.awssdk.services.vpclattice.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.vpclattice.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.vpclattice.model.ListTargetGroupsRequest;
import software.amazon.awssdk.services.vpclattice.model.ListTargetGroupsResponse;
import software.amazon.awssdk.services.vpclattice.model.ListTargetsRequest;
import software.amazon.awssdk.services.vpclattice.model.ListTargetsResponse;
import software.amazon.awssdk.services.vpclattice.model.PutAuthPolicyRequest;
import software.amazon.awssdk.services.vpclattice.model.PutAuthPolicyResponse;
import software.amazon.awssdk.services.vpclattice.model.PutResourcePolicyRequest;
import software.amazon.awssdk.services.vpclattice.model.PutResourcePolicyResponse;
import software.amazon.awssdk.services.vpclattice.model.RegisterTargetsRequest;
import software.amazon.awssdk.services.vpclattice.model.RegisterTargetsResponse;
import software.amazon.awssdk.services.vpclattice.model.ResourceNotFoundException;
import software.amazon.awssdk.services.vpclattice.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.vpclattice.model.TagResourceRequest;
import software.amazon.awssdk.services.vpclattice.model.TagResourceResponse;
import software.amazon.awssdk.services.vpclattice.model.ThrottlingException;
import software.amazon.awssdk.services.vpclattice.model.UntagResourceRequest;
import software.amazon.awssdk.services.vpclattice.model.UntagResourceResponse;
import software.amazon.awssdk.services.vpclattice.model.UpdateAccessLogSubscriptionRequest;
import software.amazon.awssdk.services.vpclattice.model.UpdateAccessLogSubscriptionResponse;
import software.amazon.awssdk.services.vpclattice.model.UpdateListenerRequest;
import software.amazon.awssdk.services.vpclattice.model.UpdateListenerResponse;
import software.amazon.awssdk.services.vpclattice.model.UpdateRuleRequest;
import software.amazon.awssdk.services.vpclattice.model.UpdateRuleResponse;
import software.amazon.awssdk.services.vpclattice.model.UpdateServiceNetworkRequest;
import software.amazon.awssdk.services.vpclattice.model.UpdateServiceNetworkResponse;
import software.amazon.awssdk.services.vpclattice.model.UpdateServiceNetworkVpcAssociationRequest;
import software.amazon.awssdk.services.vpclattice.model.UpdateServiceNetworkVpcAssociationResponse;
import software.amazon.awssdk.services.vpclattice.model.UpdateServiceRequest;
import software.amazon.awssdk.services.vpclattice.model.UpdateServiceResponse;
import software.amazon.awssdk.services.vpclattice.model.UpdateTargetGroupRequest;
import software.amazon.awssdk.services.vpclattice.model.UpdateTargetGroupResponse;
import software.amazon.awssdk.services.vpclattice.model.ValidationException;
import software.amazon.awssdk.services.vpclattice.model.VpcLatticeException;
import software.amazon.awssdk.services.vpclattice.transform.BatchUpdateRuleRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.CreateAccessLogSubscriptionRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.CreateListenerRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.CreateRuleRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.CreateServiceNetworkRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.CreateServiceNetworkServiceAssociationRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.CreateServiceNetworkVpcAssociationRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.CreateServiceRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.CreateTargetGroupRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeleteAccessLogSubscriptionRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeleteAuthPolicyRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeleteListenerRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeleteResourcePolicyRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeleteRuleRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeleteServiceNetworkRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeleteServiceNetworkServiceAssociationRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeleteServiceNetworkVpcAssociationRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeleteServiceRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeleteTargetGroupRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.DeregisterTargetsRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.GetAccessLogSubscriptionRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.GetAuthPolicyRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.GetListenerRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.GetResourcePolicyRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.GetRuleRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.GetServiceNetworkRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.GetServiceNetworkServiceAssociationRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.GetServiceNetworkVpcAssociationRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.GetServiceRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.GetTargetGroupRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.ListAccessLogSubscriptionsRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.ListListenersRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.ListRulesRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.ListServiceNetworkServiceAssociationsRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.ListServiceNetworkVpcAssociationsRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.ListServiceNetworksRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.ListServicesRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.ListTargetGroupsRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.ListTargetsRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.PutAuthPolicyRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.PutResourcePolicyRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.RegisterTargetsRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.UpdateAccessLogSubscriptionRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.UpdateListenerRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.UpdateRuleRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.UpdateServiceNetworkRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.UpdateServiceNetworkVpcAssociationRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.UpdateServiceRequestMarshaller;
import software.amazon.awssdk.services.vpclattice.transform.UpdateTargetGroupRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link VpcLatticeAsyncClient}.
*
* @see VpcLatticeAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultVpcLatticeAsyncClient implements VpcLatticeAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultVpcLatticeAsyncClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
.serviceProtocol(AwsServiceProtocol.REST_JSON).build();
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultVpcLatticeAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
/**
*
* Updates the listener rules in a batch. You can use this operation to change the priority of listener rules. This
* can be useful when bulk updating or swapping rule priority.
*
*
* Required permissions: vpc-lattice:UpdateRule
*
*
* For more information, see How Amazon VPC
* Lattice works with IAM in the Amazon VPC Lattice User Guide.
*
*
* @param batchUpdateRuleRequest
* @return A Java Future containing the result of the BatchUpdateRule operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.BatchUpdateRule
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture batchUpdateRule(BatchUpdateRuleRequest batchUpdateRuleRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(batchUpdateRuleRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, batchUpdateRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchUpdateRule");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, BatchUpdateRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("BatchUpdateRule").withProtocolMetadata(protocolMetadata)
.withMarshaller(new BatchUpdateRuleRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(batchUpdateRuleRequest));
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);
}
}
/**
*
* Enables access logs to be sent to Amazon CloudWatch, Amazon S3, and Amazon Kinesis Data Firehose. The service
* network owner can use the access logs to audit the services in the network. The service network owner can only
* see access logs from clients and services that are associated with their service network. Access log entries
* represent traffic originated from VPCs associated with that network. For more information, see Access logs in the
* Amazon VPC Lattice User Guide.
*
*
* @param createAccessLogSubscriptionRequest
* @return A Java Future containing the result of the CreateAccessLogSubscription operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.CreateAccessLogSubscription
* @see AWS API Documentation
*/
@Override
public CompletableFuture createAccessLogSubscription(
CreateAccessLogSubscriptionRequest createAccessLogSubscriptionRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createAccessLogSubscriptionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createAccessLogSubscriptionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAccessLogSubscription");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateAccessLogSubscriptionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateAccessLogSubscription").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateAccessLogSubscriptionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createAccessLogSubscriptionRequest));
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 listener for a service. Before you start using your Amazon VPC Lattice service, you must add one or
* more listeners. A listener is a process that checks for connection requests to your services. For more
* information, see Listeners in the
* Amazon VPC Lattice User Guide.
*
*
* @param createListenerRequest
* @return A Java Future containing the result of the CreateListener operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - ServiceQuotaExceededException The request would cause a service quota to be exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.CreateListener
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createListener(CreateListenerRequest createListenerRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createListenerRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createListenerRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateListener");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateListenerResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateListener").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateListenerRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createListenerRequest));
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 listener rule. Each listener has a default rule for checking connection requests, but you can define
* additional rules. Each rule consists of a priority, one or more actions, and one or more conditions. For more
* information, see Listener rules in the
* Amazon VPC Lattice User Guide.
*
*
* @param createRuleRequest
* @return A Java Future containing the result of the CreateRule operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - ServiceQuotaExceededException The request would cause a service quota to be exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.CreateRule
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createRule(CreateRuleRequest createRuleRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createRuleRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateRule");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("CreateRule")
.withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateRuleRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createRuleRequest));
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 service. A service is any software application that can run on instances containers, or serverless
* functions within an account or virtual private cloud (VPC).
*
*
* For more information, see Services
* in the Amazon VPC Lattice User Guide.
*
*
* @param createServiceRequest
* @return A Java Future containing the result of the CreateService operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - ServiceQuotaExceededException The request would cause a service quota to be exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.CreateService
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createService(CreateServiceRequest createServiceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createServiceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createServiceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateService");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateServiceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateService").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateServiceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createServiceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a service network. A service network is a logical boundary for a collection of services. You can
* associate services and VPCs with a service network.
*
*
* For more information, see Service networks in the
* Amazon VPC Lattice User Guide.
*
*
* @param createServiceNetworkRequest
* @return A Java Future containing the result of the CreateServiceNetwork operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - ServiceQuotaExceededException The request would cause a service quota to be exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.CreateServiceNetwork
* @see AWS API Documentation
*/
@Override
public CompletableFuture createServiceNetwork(
CreateServiceNetworkRequest createServiceNetworkRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createServiceNetworkRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createServiceNetworkRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateServiceNetwork");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateServiceNetworkResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateServiceNetwork").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateServiceNetworkRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createServiceNetworkRequest));
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 service with a service network. For more information, see Manage service associations in the Amazon VPC Lattice User Guide.
*
*
* You can't use this operation if the service and service network are already associated or if there is a
* disassociation or deletion in progress. If the association fails, you can retry the operation by deleting the
* association and recreating it.
*
*
* You cannot associate a service and service network that are shared with a caller. The caller must own either the
* service or the service network.
*
*
* As a result of this operation, the association is created in the service network account and the association
* owner account.
*
*
* @param createServiceNetworkServiceAssociationRequest
* @return A Java Future containing the result of the CreateServiceNetworkServiceAssociation operation returned by
* the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - ServiceQuotaExceededException The request would cause a service quota to be exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.CreateServiceNetworkServiceAssociation
* @see AWS API Documentation
*/
@Override
public CompletableFuture createServiceNetworkServiceAssociation(
CreateServiceNetworkServiceAssociationRequest createServiceNetworkServiceAssociationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createServiceNetworkServiceAssociationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
createServiceNetworkServiceAssociationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateServiceNetworkServiceAssociation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, CreateServiceNetworkServiceAssociationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateServiceNetworkServiceAssociation").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateServiceNetworkServiceAssociationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createServiceNetworkServiceAssociationRequest));
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 VPC with a service network. When you associate a VPC with the service network, it enables all the
* resources within that VPC to be clients and communicate with other services in the service network. For more
* information, see Manage VPC associations in the Amazon VPC Lattice User Guide.
*
*
* You can't use this operation if there is a disassociation in progress. If the association fails, retry by
* deleting the association and recreating it.
*
*
* As a result of this operation, the association gets created in the service network account and the VPC owner
* account.
*
*
* If you add a security group to the service network and VPC association, the association must continue to always
* have at least one security group. You can add or edit security groups at any time. However, to remove all
* security groups, you must first delete the association and recreate it without security groups.
*
*
* @param createServiceNetworkVpcAssociationRequest
* @return A Java Future containing the result of the CreateServiceNetworkVpcAssociation operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - ServiceQuotaExceededException The request would cause a service quota to be exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.CreateServiceNetworkVpcAssociation
* @see AWS API Documentation
*/
@Override
public CompletableFuture createServiceNetworkVpcAssociation(
CreateServiceNetworkVpcAssociationRequest createServiceNetworkVpcAssociationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createServiceNetworkVpcAssociationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
createServiceNetworkVpcAssociationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateServiceNetworkVpcAssociation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, CreateServiceNetworkVpcAssociationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateServiceNetworkVpcAssociation").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateServiceNetworkVpcAssociationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createServiceNetworkVpcAssociationRequest));
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 target group. A target group is a collection of targets, or compute resources, that run your
* application or service. A target group can only be used by a single service.
*
*
* For more information, see Target
* groups in the Amazon VPC Lattice User Guide.
*
*
* @param createTargetGroupRequest
* @return A Java Future containing the result of the CreateTargetGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - ServiceQuotaExceededException The request would cause a service quota to be exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.CreateTargetGroup
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createTargetGroup(CreateTargetGroupRequest createTargetGroupRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createTargetGroupRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createTargetGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateTargetGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateTargetGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateTargetGroup").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateTargetGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createTargetGroupRequest));
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 access log subscription.
*
*
* @param deleteAccessLogSubscriptionRequest
* @return A Java Future containing the result of the DeleteAccessLogSubscription operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeleteAccessLogSubscription
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteAccessLogSubscription(
DeleteAccessLogSubscriptionRequest deleteAccessLogSubscriptionRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAccessLogSubscriptionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAccessLogSubscriptionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAccessLogSubscription");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteAccessLogSubscriptionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteAccessLogSubscription").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteAccessLogSubscriptionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteAccessLogSubscriptionRequest));
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 auth policy. If an auth is set to AWS_IAM
and the auth policy is deleted, all
* requests are denied. If you are trying to remove the auth policy completely, you must set the auth type to
* NONE
. If auth is enabled on the resource, but no auth policy is set, all requests are denied.
*
*
* @param deleteAuthPolicyRequest
* @return A Java Future containing the result of the DeleteAuthPolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeleteAuthPolicy
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteAuthPolicy(DeleteAuthPolicyRequest deleteAuthPolicyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAuthPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAuthPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAuthPolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteAuthPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteAuthPolicy").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteAuthPolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteAuthPolicyRequest));
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 listener.
*
*
* @param deleteListenerRequest
* @return A Java Future containing the result of the DeleteListener operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeleteListener
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteListener(DeleteListenerRequest deleteListenerRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteListenerRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteListenerRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteListener");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteListenerResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteListener").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteListenerRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteListenerRequest));
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 resource policy.
*
*
* @param deleteResourcePolicyRequest
* @return A Java Future containing the result of the DeleteResourcePolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeleteResourcePolicy
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteResourcePolicy(
DeleteResourcePolicyRequest deleteResourcePolicyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteResourcePolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteResourcePolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteResourcePolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteResourcePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteResourcePolicy").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteResourcePolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteResourcePolicyRequest));
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 listener rule. Each listener has a default rule for checking connection requests, but you can define
* additional rules. Each rule consists of a priority, one or more actions, and one or more conditions. You can
* delete additional listener rules, but you cannot delete the default rule.
*
*
* For more information, see Listener rules in the
* Amazon VPC Lattice User Guide.
*
*
* @param deleteRuleRequest
* @return A Java Future containing the result of the DeleteRule operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeleteRule
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteRule(DeleteRuleRequest deleteRuleRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteRuleRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRule");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("DeleteRule")
.withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteRuleRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteRuleRequest));
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 service. A service can't be deleted if it's associated with a service network. If you delete a service,
* all resources related to the service, such as the resource policy, auth policy, listeners, listener rules, and
* access log subscriptions, are also deleted. For more information, see Delete a service in the
* Amazon VPC Lattice User Guide.
*
*
* @param deleteServiceRequest
* @return A Java Future containing the result of the DeleteService operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeleteService
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteService(DeleteServiceRequest deleteServiceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteServiceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteServiceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteService");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteServiceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteService").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteServiceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteServiceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes a service network. You can only delete the service network if there is no service or VPC associated with
* it. If you delete a service network, all resources related to the service network, such as the resource policy,
* auth policy, and access log subscriptions, are also deleted. For more information, see Delete a
* service network in the Amazon VPC Lattice User Guide.
*
*
* @param deleteServiceNetworkRequest
* @return A Java Future containing the result of the DeleteServiceNetwork operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeleteServiceNetwork
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteServiceNetwork(
DeleteServiceNetworkRequest deleteServiceNetworkRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteServiceNetworkRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteServiceNetworkRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteServiceNetwork");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteServiceNetworkResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteServiceNetwork").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteServiceNetworkRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteServiceNetworkRequest));
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 association between a specified service and the specific service network. This operation fails if an
* association is still in progress.
*
*
* @param deleteServiceNetworkServiceAssociationRequest
* @return A Java Future containing the result of the DeleteServiceNetworkServiceAssociation operation returned by
* the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeleteServiceNetworkServiceAssociation
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteServiceNetworkServiceAssociation(
DeleteServiceNetworkServiceAssociationRequest deleteServiceNetworkServiceAssociationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteServiceNetworkServiceAssociationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteServiceNetworkServiceAssociationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteServiceNetworkServiceAssociation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, DeleteServiceNetworkServiceAssociationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteServiceNetworkServiceAssociation").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteServiceNetworkServiceAssociationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteServiceNetworkServiceAssociationRequest));
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);
}
}
/**
*
* Disassociates the VPC from the service network. You can't disassociate the VPC if there is a create or update
* association in progress.
*
*
* @param deleteServiceNetworkVpcAssociationRequest
* @return A Java Future containing the result of the DeleteServiceNetworkVpcAssociation operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeleteServiceNetworkVpcAssociation
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteServiceNetworkVpcAssociation(
DeleteServiceNetworkVpcAssociationRequest deleteServiceNetworkVpcAssociationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteServiceNetworkVpcAssociationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteServiceNetworkVpcAssociationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteServiceNetworkVpcAssociation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, DeleteServiceNetworkVpcAssociationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteServiceNetworkVpcAssociation").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteServiceNetworkVpcAssociationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteServiceNetworkVpcAssociationRequest));
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 target group. You can't delete a target group if it is used in a listener rule or if the target group
* creation is in progress.
*
*
* @param deleteTargetGroupRequest
* @return A Java Future containing the result of the DeleteTargetGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeleteTargetGroup
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteTargetGroup(DeleteTargetGroupRequest deleteTargetGroupRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteTargetGroupRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteTargetGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteTargetGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteTargetGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteTargetGroup").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteTargetGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteTargetGroupRequest));
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);
}
}
/**
*
* Deregisters the specified targets from the specified target group.
*
*
* @param deregisterTargetsRequest
* @return A Java Future containing the result of the DeregisterTargets operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - ConflictException The request conflicts with the current state of the resource. Updating or deleting
* a resource can cause an inconsistent state.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.DeregisterTargets
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deregisterTargets(DeregisterTargetsRequest deregisterTargetsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deregisterTargetsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deregisterTargetsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeregisterTargets");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeregisterTargetsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeregisterTargets").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeregisterTargetsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deregisterTargetsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the specified access log subscription.
*
*
* @param getAccessLogSubscriptionRequest
* @return A Java Future containing the result of the GetAccessLogSubscription operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.GetAccessLogSubscription
* @see AWS API Documentation
*/
@Override
public CompletableFuture getAccessLogSubscription(
GetAccessLogSubscriptionRequest getAccessLogSubscriptionRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getAccessLogSubscriptionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getAccessLogSubscriptionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAccessLogSubscription");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetAccessLogSubscriptionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetAccessLogSubscription").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetAccessLogSubscriptionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getAccessLogSubscriptionRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the auth policy for the specified service or service network.
*
*
* @param getAuthPolicyRequest
* @return A Java Future containing the result of the GetAuthPolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.GetAuthPolicy
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getAuthPolicy(GetAuthPolicyRequest getAuthPolicyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getAuthPolicyRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getAuthPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAuthPolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetAuthPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetAuthPolicy").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetAuthPolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getAuthPolicyRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the specified listener for the specified service.
*
*
* @param getListenerRequest
* @return A Java Future containing the result of the GetListener operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.GetListener
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getListener(GetListenerRequest getListenerRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getListenerRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getListenerRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetListener");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetListenerResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetListener").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetListenerRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getListenerRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the resource policy. The resource policy is an IAM policy created on behalf of the
* resource owner when they share a resource.
*
*
* @param getResourcePolicyRequest
* @return A Java Future containing the result of the GetResourcePolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.GetResourcePolicy
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getResourcePolicy(GetResourcePolicyRequest getResourcePolicyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getResourcePolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getResourcePolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetResourcePolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetResourcePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetResourcePolicy").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetResourcePolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getResourcePolicyRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about listener rules. You can also retrieve information about the default listener rule.
* For more information, see Listener rules in the
* Amazon VPC Lattice User Guide.
*
*
* @param getRuleRequest
* @return A Java Future containing the result of the GetRule operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.GetRule
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getRule(GetRuleRequest getRuleRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRuleRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRule");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("GetRule")
.withProtocolMetadata(protocolMetadata).withMarshaller(new GetRuleRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getRuleRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the specified service.
*
*
* @param getServiceRequest
* @return A Java Future containing the result of the GetService operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.GetService
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getService(GetServiceRequest getServiceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getServiceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getServiceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetService");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetServiceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("GetService")
.withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetServiceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getServiceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the specified service network.
*
*
* @param getServiceNetworkRequest
* @return A Java Future containing the result of the GetServiceNetwork operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.GetServiceNetwork
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getServiceNetwork(GetServiceNetworkRequest getServiceNetworkRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getServiceNetworkRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getServiceNetworkRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetServiceNetwork");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetServiceNetworkResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetServiceNetwork").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetServiceNetworkRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getServiceNetworkRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the specified association between a service network and a service.
*
*
* @param getServiceNetworkServiceAssociationRequest
* @return A Java Future containing the result of the GetServiceNetworkServiceAssociation operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.GetServiceNetworkServiceAssociation
* @see AWS API Documentation
*/
@Override
public CompletableFuture getServiceNetworkServiceAssociation(
GetServiceNetworkServiceAssociationRequest getServiceNetworkServiceAssociationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getServiceNetworkServiceAssociationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getServiceNetworkServiceAssociationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetServiceNetworkServiceAssociation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, GetServiceNetworkServiceAssociationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetServiceNetworkServiceAssociation").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetServiceNetworkServiceAssociationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getServiceNetworkServiceAssociationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the association between a service network and a VPC.
*
*
* @param getServiceNetworkVpcAssociationRequest
* @return A Java Future containing the result of the GetServiceNetworkVpcAssociation operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.GetServiceNetworkVpcAssociation
* @see AWS API Documentation
*/
@Override
public CompletableFuture getServiceNetworkVpcAssociation(
GetServiceNetworkVpcAssociationRequest getServiceNetworkVpcAssociationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getServiceNetworkVpcAssociationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getServiceNetworkVpcAssociationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetServiceNetworkVpcAssociation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetServiceNetworkVpcAssociationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetServiceNetworkVpcAssociation").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetServiceNetworkVpcAssociationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getServiceNetworkVpcAssociationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the specified target group.
*
*
* @param getTargetGroupRequest
* @return A Java Future containing the result of the GetTargetGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.GetTargetGroup
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getTargetGroup(GetTargetGroupRequest getTargetGroupRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getTargetGroupRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getTargetGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetTargetGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetTargetGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetTargetGroup").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetTargetGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getTargetGroupRequest));
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 access log subscriptions for the specified service network or service.
*
*
* @param listAccessLogSubscriptionsRequest
* @return A Java Future containing the result of the ListAccessLogSubscriptions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.ListAccessLogSubscriptions
* @see AWS API Documentation
*/
@Override
public CompletableFuture listAccessLogSubscriptions(
ListAccessLogSubscriptionsRequest listAccessLogSubscriptionsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listAccessLogSubscriptionsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listAccessLogSubscriptionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAccessLogSubscriptions");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListAccessLogSubscriptionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListAccessLogSubscriptions").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListAccessLogSubscriptionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(listAccessLogSubscriptionsRequest));
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 listeners for the specified service.
*
*
* @param listListenersRequest
* @return A Java Future containing the result of the ListListeners operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.ListListeners
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listListeners(ListListenersRequest listListenersRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listListenersRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listListenersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListListeners");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListListenersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListListeners").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListListenersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(listListenersRequest));
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 rules for the listener.
*
*
* @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. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - ResourceNotFoundException The request references a resource that does not exist.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.ListRules
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listRules(ListRulesRequest listRulesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listRulesRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listRulesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
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")
.withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListRulesRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.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 the associations between the service network and the service. You can filter the list either by service or
* service network. You must provide either the service network identifier or the service identifier.
*
*
* Every association in Amazon VPC Lattice is given a unique Amazon Resource Name (ARN), such as when a service
* network is associated with a VPC or when a service is associated with a service network. If the association is
* for a resource that is shared with another account, the association includes the local account ID as the prefix
* in the ARN for each account the resource is shared with.
*
*
* @param listServiceNetworkServiceAssociationsRequest
* @return A Java Future containing the result of the ListServiceNetworkServiceAssociations operation returned by
* the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.ListServiceNetworkServiceAssociations
* @see AWS API Documentation
*/
@Override
public CompletableFuture listServiceNetworkServiceAssociations(
ListServiceNetworkServiceAssociationsRequest listServiceNetworkServiceAssociationsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listServiceNetworkServiceAssociationsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
listServiceNetworkServiceAssociationsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListServiceNetworkServiceAssociations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, ListServiceNetworkServiceAssociationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListServiceNetworkServiceAssociations").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListServiceNetworkServiceAssociationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(listServiceNetworkServiceAssociationsRequest));
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 service network and VPC associations. You can filter the list either by VPC or service network. You
* must provide either the service network identifier or the VPC identifier.
*
*
* @param listServiceNetworkVpcAssociationsRequest
* @return A Java Future containing the result of the ListServiceNetworkVpcAssociations operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.ListServiceNetworkVpcAssociations
* @see AWS API Documentation
*/
@Override
public CompletableFuture listServiceNetworkVpcAssociations(
ListServiceNetworkVpcAssociationsRequest listServiceNetworkVpcAssociationsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listServiceNetworkVpcAssociationsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
listServiceNetworkVpcAssociationsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListServiceNetworkVpcAssociations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, ListServiceNetworkVpcAssociationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListServiceNetworkVpcAssociations").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListServiceNetworkVpcAssociationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(listServiceNetworkVpcAssociationsRequest));
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 service networks owned by the caller account or shared with the caller account. Also includes the
* account ID in the ARN to show which account owns the service network.
*
*
* @param listServiceNetworksRequest
* @return A Java Future containing the result of the ListServiceNetworks operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - ValidationException The input does not satisfy the constraints specified by an Amazon Web Services
* service.
* - AccessDeniedException The user does not have sufficient access to perform this action.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - InternalServerException An unexpected error occurred while processing 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.
* - VpcLatticeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample VpcLatticeAsyncClient.ListServiceNetworks
* @see AWS API Documentation
*/
@Override
public CompletableFuture listServiceNetworks(
ListServiceNetworksRequest listServiceNetworksRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listServiceNetworksRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listServiceNetworksRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "VPC Lattice");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListServiceNetworks");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListServiceNetworksResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListServiceNetworks").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListServiceNetworksRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(listServiceNetworksRequest));
CompletableFuture