All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.autoscaling.DefaultAutoScalingAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Auto Scaling module holds the client classes that are used for communicating with Auto Scaling Service

The newest version!
/*
 * 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.autoscaling;

import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ScheduledExecutorService;
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.query.AwsQueryProtocolFactory;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.autoscaling.internal.AutoScalingServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.autoscaling.model.ActiveInstanceRefreshNotFoundException;
import software.amazon.awssdk.services.autoscaling.model.AlreadyExistsException;
import software.amazon.awssdk.services.autoscaling.model.AttachInstancesRequest;
import software.amazon.awssdk.services.autoscaling.model.AttachInstancesResponse;
import software.amazon.awssdk.services.autoscaling.model.AttachLoadBalancerTargetGroupsRequest;
import software.amazon.awssdk.services.autoscaling.model.AttachLoadBalancerTargetGroupsResponse;
import software.amazon.awssdk.services.autoscaling.model.AttachLoadBalancersRequest;
import software.amazon.awssdk.services.autoscaling.model.AttachLoadBalancersResponse;
import software.amazon.awssdk.services.autoscaling.model.AttachTrafficSourcesRequest;
import software.amazon.awssdk.services.autoscaling.model.AttachTrafficSourcesResponse;
import software.amazon.awssdk.services.autoscaling.model.AutoScalingException;
import software.amazon.awssdk.services.autoscaling.model.BatchDeleteScheduledActionRequest;
import software.amazon.awssdk.services.autoscaling.model.BatchDeleteScheduledActionResponse;
import software.amazon.awssdk.services.autoscaling.model.BatchPutScheduledUpdateGroupActionRequest;
import software.amazon.awssdk.services.autoscaling.model.BatchPutScheduledUpdateGroupActionResponse;
import software.amazon.awssdk.services.autoscaling.model.CancelInstanceRefreshRequest;
import software.amazon.awssdk.services.autoscaling.model.CancelInstanceRefreshResponse;
import software.amazon.awssdk.services.autoscaling.model.CompleteLifecycleActionRequest;
import software.amazon.awssdk.services.autoscaling.model.CompleteLifecycleActionResponse;
import software.amazon.awssdk.services.autoscaling.model.CreateAutoScalingGroupRequest;
import software.amazon.awssdk.services.autoscaling.model.CreateAutoScalingGroupResponse;
import software.amazon.awssdk.services.autoscaling.model.CreateLaunchConfigurationRequest;
import software.amazon.awssdk.services.autoscaling.model.CreateLaunchConfigurationResponse;
import software.amazon.awssdk.services.autoscaling.model.CreateOrUpdateTagsRequest;
import software.amazon.awssdk.services.autoscaling.model.CreateOrUpdateTagsResponse;
import software.amazon.awssdk.services.autoscaling.model.DeleteAutoScalingGroupRequest;
import software.amazon.awssdk.services.autoscaling.model.DeleteAutoScalingGroupResponse;
import software.amazon.awssdk.services.autoscaling.model.DeleteLaunchConfigurationRequest;
import software.amazon.awssdk.services.autoscaling.model.DeleteLaunchConfigurationResponse;
import software.amazon.awssdk.services.autoscaling.model.DeleteLifecycleHookRequest;
import software.amazon.awssdk.services.autoscaling.model.DeleteLifecycleHookResponse;
import software.amazon.awssdk.services.autoscaling.model.DeleteNotificationConfigurationRequest;
import software.amazon.awssdk.services.autoscaling.model.DeleteNotificationConfigurationResponse;
import software.amazon.awssdk.services.autoscaling.model.DeletePolicyRequest;
import software.amazon.awssdk.services.autoscaling.model.DeletePolicyResponse;
import software.amazon.awssdk.services.autoscaling.model.DeleteScheduledActionRequest;
import software.amazon.awssdk.services.autoscaling.model.DeleteScheduledActionResponse;
import software.amazon.awssdk.services.autoscaling.model.DeleteTagsRequest;
import software.amazon.awssdk.services.autoscaling.model.DeleteTagsResponse;
import software.amazon.awssdk.services.autoscaling.model.DeleteWarmPoolRequest;
import software.amazon.awssdk.services.autoscaling.model.DeleteWarmPoolResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeAccountLimitsRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeAccountLimitsResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeAdjustmentTypesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeAdjustmentTypesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeAutoScalingGroupsRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeAutoScalingGroupsResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeAutoScalingInstancesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeAutoScalingInstancesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeAutoScalingNotificationTypesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeAutoScalingNotificationTypesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeInstanceRefreshesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeInstanceRefreshesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeLaunchConfigurationsRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeLaunchConfigurationsResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeLifecycleHookTypesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeLifecycleHookTypesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeLifecycleHooksRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeLifecycleHooksResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeLoadBalancerTargetGroupsRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeLoadBalancerTargetGroupsResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeLoadBalancersRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeLoadBalancersResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeMetricCollectionTypesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeMetricCollectionTypesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeNotificationConfigurationsRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeNotificationConfigurationsResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribePoliciesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribePoliciesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeScalingActivitiesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeScalingActivitiesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeScalingProcessTypesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeScalingProcessTypesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeScheduledActionsRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeScheduledActionsResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeTagsRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeTagsResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeTerminationPolicyTypesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeTerminationPolicyTypesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeTrafficSourcesRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeTrafficSourcesResponse;
import software.amazon.awssdk.services.autoscaling.model.DescribeWarmPoolRequest;
import software.amazon.awssdk.services.autoscaling.model.DescribeWarmPoolResponse;
import software.amazon.awssdk.services.autoscaling.model.DetachInstancesRequest;
import software.amazon.awssdk.services.autoscaling.model.DetachInstancesResponse;
import software.amazon.awssdk.services.autoscaling.model.DetachLoadBalancerTargetGroupsRequest;
import software.amazon.awssdk.services.autoscaling.model.DetachLoadBalancerTargetGroupsResponse;
import software.amazon.awssdk.services.autoscaling.model.DetachLoadBalancersRequest;
import software.amazon.awssdk.services.autoscaling.model.DetachLoadBalancersResponse;
import software.amazon.awssdk.services.autoscaling.model.DetachTrafficSourcesRequest;
import software.amazon.awssdk.services.autoscaling.model.DetachTrafficSourcesResponse;
import software.amazon.awssdk.services.autoscaling.model.DisableMetricsCollectionRequest;
import software.amazon.awssdk.services.autoscaling.model.DisableMetricsCollectionResponse;
import software.amazon.awssdk.services.autoscaling.model.EnableMetricsCollectionRequest;
import software.amazon.awssdk.services.autoscaling.model.EnableMetricsCollectionResponse;
import software.amazon.awssdk.services.autoscaling.model.EnterStandbyRequest;
import software.amazon.awssdk.services.autoscaling.model.EnterStandbyResponse;
import software.amazon.awssdk.services.autoscaling.model.ExecutePolicyRequest;
import software.amazon.awssdk.services.autoscaling.model.ExecutePolicyResponse;
import software.amazon.awssdk.services.autoscaling.model.ExitStandbyRequest;
import software.amazon.awssdk.services.autoscaling.model.ExitStandbyResponse;
import software.amazon.awssdk.services.autoscaling.model.GetPredictiveScalingForecastRequest;
import software.amazon.awssdk.services.autoscaling.model.GetPredictiveScalingForecastResponse;
import software.amazon.awssdk.services.autoscaling.model.InstanceRefreshInProgressException;
import software.amazon.awssdk.services.autoscaling.model.InvalidNextTokenException;
import software.amazon.awssdk.services.autoscaling.model.IrreversibleInstanceRefreshException;
import software.amazon.awssdk.services.autoscaling.model.LimitExceededException;
import software.amazon.awssdk.services.autoscaling.model.PutLifecycleHookRequest;
import software.amazon.awssdk.services.autoscaling.model.PutLifecycleHookResponse;
import software.amazon.awssdk.services.autoscaling.model.PutNotificationConfigurationRequest;
import software.amazon.awssdk.services.autoscaling.model.PutNotificationConfigurationResponse;
import software.amazon.awssdk.services.autoscaling.model.PutScalingPolicyRequest;
import software.amazon.awssdk.services.autoscaling.model.PutScalingPolicyResponse;
import software.amazon.awssdk.services.autoscaling.model.PutScheduledUpdateGroupActionRequest;
import software.amazon.awssdk.services.autoscaling.model.PutScheduledUpdateGroupActionResponse;
import software.amazon.awssdk.services.autoscaling.model.PutWarmPoolRequest;
import software.amazon.awssdk.services.autoscaling.model.PutWarmPoolResponse;
import software.amazon.awssdk.services.autoscaling.model.RecordLifecycleActionHeartbeatRequest;
import software.amazon.awssdk.services.autoscaling.model.RecordLifecycleActionHeartbeatResponse;
import software.amazon.awssdk.services.autoscaling.model.ResourceContentionException;
import software.amazon.awssdk.services.autoscaling.model.ResourceInUseException;
import software.amazon.awssdk.services.autoscaling.model.ResumeProcessesRequest;
import software.amazon.awssdk.services.autoscaling.model.ResumeProcessesResponse;
import software.amazon.awssdk.services.autoscaling.model.RollbackInstanceRefreshRequest;
import software.amazon.awssdk.services.autoscaling.model.RollbackInstanceRefreshResponse;
import software.amazon.awssdk.services.autoscaling.model.ScalingActivityInProgressException;
import software.amazon.awssdk.services.autoscaling.model.ServiceLinkedRoleFailureException;
import software.amazon.awssdk.services.autoscaling.model.SetDesiredCapacityRequest;
import software.amazon.awssdk.services.autoscaling.model.SetDesiredCapacityResponse;
import software.amazon.awssdk.services.autoscaling.model.SetInstanceHealthRequest;
import software.amazon.awssdk.services.autoscaling.model.SetInstanceHealthResponse;
import software.amazon.awssdk.services.autoscaling.model.SetInstanceProtectionRequest;
import software.amazon.awssdk.services.autoscaling.model.SetInstanceProtectionResponse;
import software.amazon.awssdk.services.autoscaling.model.StartInstanceRefreshRequest;
import software.amazon.awssdk.services.autoscaling.model.StartInstanceRefreshResponse;
import software.amazon.awssdk.services.autoscaling.model.SuspendProcessesRequest;
import software.amazon.awssdk.services.autoscaling.model.SuspendProcessesResponse;
import software.amazon.awssdk.services.autoscaling.model.TerminateInstanceInAutoScalingGroupRequest;
import software.amazon.awssdk.services.autoscaling.model.TerminateInstanceInAutoScalingGroupResponse;
import software.amazon.awssdk.services.autoscaling.model.UpdateAutoScalingGroupRequest;
import software.amazon.awssdk.services.autoscaling.model.UpdateAutoScalingGroupResponse;
import software.amazon.awssdk.services.autoscaling.transform.AttachInstancesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.AttachLoadBalancerTargetGroupsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.AttachLoadBalancersRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.AttachTrafficSourcesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.BatchDeleteScheduledActionRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.BatchPutScheduledUpdateGroupActionRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.CancelInstanceRefreshRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.CompleteLifecycleActionRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.CreateAutoScalingGroupRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.CreateLaunchConfigurationRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.CreateOrUpdateTagsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DeleteAutoScalingGroupRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DeleteLaunchConfigurationRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DeleteLifecycleHookRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DeleteNotificationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DeletePolicyRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DeleteScheduledActionRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DeleteTagsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DeleteWarmPoolRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeAccountLimitsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeAdjustmentTypesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeAutoScalingGroupsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeAutoScalingInstancesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeAutoScalingNotificationTypesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeInstanceRefreshesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeLaunchConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeLifecycleHookTypesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeLifecycleHooksRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeLoadBalancerTargetGroupsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeLoadBalancersRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeMetricCollectionTypesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeNotificationConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribePoliciesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeScalingActivitiesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeScalingProcessTypesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeScheduledActionsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeTagsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeTerminationPolicyTypesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeTrafficSourcesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DescribeWarmPoolRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DetachInstancesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DetachLoadBalancerTargetGroupsRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DetachLoadBalancersRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DetachTrafficSourcesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.DisableMetricsCollectionRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.EnableMetricsCollectionRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.EnterStandbyRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.ExecutePolicyRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.ExitStandbyRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.GetPredictiveScalingForecastRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.PutLifecycleHookRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.PutNotificationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.PutScalingPolicyRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.PutScheduledUpdateGroupActionRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.PutWarmPoolRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.RecordLifecycleActionHeartbeatRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.ResumeProcessesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.RollbackInstanceRefreshRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.SetDesiredCapacityRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.SetInstanceHealthRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.SetInstanceProtectionRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.StartInstanceRefreshRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.SuspendProcessesRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.TerminateInstanceInAutoScalingGroupRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.transform.UpdateAutoScalingGroupRequestMarshaller;
import software.amazon.awssdk.services.autoscaling.waiters.AutoScalingAsyncWaiter;
import software.amazon.awssdk.utils.CompletableFutureUtils;

/**
 * Internal implementation of {@link AutoScalingAsyncClient}.
 *
 * @see AutoScalingAsyncClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultAutoScalingAsyncClient implements AutoScalingAsyncClient {
    private static final Logger log = LoggerFactory.getLogger(DefaultAutoScalingAsyncClient.class);

    private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
            .serviceProtocol(AwsServiceProtocol.QUERY).build();

    private final AsyncClientHandler clientHandler;

    private final AwsQueryProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    private final ScheduledExecutorService executorService;

    protected DefaultAutoScalingAsyncClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init();
        this.executorService = clientConfiguration.option(SdkClientOption.SCHEDULED_EXECUTOR_SERVICE);
    }

    /**
     * 

* Attaches one or more EC2 instances to the specified Auto Scaling group. *

*

* When you attach instances, Amazon EC2 Auto Scaling increases the desired capacity of the group by the number of * instances being attached. If the number of instances being attached plus the desired capacity of the group * exceeds the maximum size of the group, the operation fails. *

*

* If there is a Classic Load Balancer attached to your Auto Scaling group, the instances are also registered with * the load balancer. If there are target groups attached to your Auto Scaling group, the instances are also * registered with the target groups. *

*

* For more information, see Detach * or attach instances in the Amazon EC2 Auto Scaling User Guide. *

* * @param attachInstancesRequest * @return A Java Future containing the result of the AttachInstances 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.AttachInstances * @see AWS * API Documentation */ @Override public CompletableFuture attachInstances(AttachInstancesRequest attachInstancesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(attachInstancesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, attachInstancesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AttachInstances"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(AttachInstancesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("AttachInstances").withProtocolMetadata(protocolMetadata) .withMarshaller(new AttachInstancesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(attachInstancesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** * *

* This API operation is superseded by AttachTrafficSources, which can attach multiple traffic sources types. We recommend using * AttachTrafficSources to simplify how you manage traffic sources. However, we continue to support * AttachLoadBalancerTargetGroups. You can use both the original * AttachLoadBalancerTargetGroups API operation and AttachTrafficSources on the same Auto * Scaling group. *

*
*

* Attaches one or more target groups to the specified Auto Scaling group. *

*

* This operation is used with the following load balancer types: *

*
    *
  • *

    * Application Load Balancer - Operates at the application layer (layer 7) and supports HTTP and HTTPS. *

    *
  • *
  • *

    * Network Load Balancer - Operates at the transport layer (layer 4) and supports TCP, TLS, and UDP. *

    *
  • *
  • *

    * Gateway Load Balancer - Operates at the network layer (layer 3). *

    *
  • *
*

* To describe the target groups for an Auto Scaling group, call the DescribeLoadBalancerTargetGroups API. To detach the target group from the Auto Scaling group, call the * DetachLoadBalancerTargetGroups API. *

*

* This operation is additive and does not detach existing target groups or Classic Load Balancers from the Auto * Scaling group. *

*

* For more information, see Use Elastic Load * Balancing to distribute traffic across the instances in your Auto Scaling group in the Amazon EC2 Auto * Scaling User Guide. *

* * @param attachLoadBalancerTargetGroupsRequest * @return A Java Future containing the result of the AttachLoadBalancerTargetGroups 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.AttachLoadBalancerTargetGroups * @see AWS API Documentation */ @Override public CompletableFuture attachLoadBalancerTargetGroups( AttachLoadBalancerTargetGroupsRequest attachLoadBalancerTargetGroupsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(attachLoadBalancerTargetGroupsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, attachLoadBalancerTargetGroupsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AttachLoadBalancerTargetGroups"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(AttachLoadBalancerTargetGroupsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("AttachLoadBalancerTargetGroups").withProtocolMetadata(protocolMetadata) .withMarshaller(new AttachLoadBalancerTargetGroupsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(attachLoadBalancerTargetGroupsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** * *

* This API operation is superseded by https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_AttachTrafficSources.html, which can attach * multiple traffic sources types. We recommend using AttachTrafficSources to simplify how you manage * traffic sources. However, we continue to support AttachLoadBalancers. You can use both the original * AttachLoadBalancers API operation and AttachTrafficSources on the same Auto Scaling * group. *

*
*

* Attaches one or more Classic Load Balancers to the specified Auto Scaling group. Amazon EC2 Auto Scaling * registers the running instances with these Classic Load Balancers. *

*

* To describe the load balancers for an Auto Scaling group, call the DescribeLoadBalancers API. To detach a load balancer from the Auto Scaling group, call the DetachLoadBalancers API. *

*

* This operation is additive and does not detach existing Classic Load Balancers or target groups from the Auto * Scaling group. *

*

* For more information, see Use Elastic Load * Balancing to distribute traffic across the instances in your Auto Scaling group in the Amazon EC2 Auto * Scaling User Guide. *

* * @param attachLoadBalancersRequest * @return A Java Future containing the result of the AttachLoadBalancers 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.AttachLoadBalancers * @see AWS API Documentation */ @Override public CompletableFuture attachLoadBalancers( AttachLoadBalancersRequest attachLoadBalancersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(attachLoadBalancersRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, attachLoadBalancersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AttachLoadBalancers"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(AttachLoadBalancersResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("AttachLoadBalancers").withProtocolMetadata(protocolMetadata) .withMarshaller(new AttachLoadBalancersRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(attachLoadBalancersRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Attaches one or more traffic sources to the specified Auto Scaling group. *

*

* You can use any of the following as traffic sources for an Auto Scaling group: *

*
    *
  • *

    * Application Load Balancer *

    *
  • *
  • *

    * Classic Load Balancer *

    *
  • *
  • *

    * Gateway Load Balancer *

    *
  • *
  • *

    * Network Load Balancer *

    *
  • *
  • *

    * VPC Lattice *

    *
  • *
*

* This operation is additive and does not detach existing traffic sources from the Auto Scaling group. *

*

* After the operation completes, use the DescribeTrafficSources API to return details about the state of the attachments between traffic sources and * your Auto Scaling group. To detach a traffic source from the Auto Scaling group, call the DetachTrafficSources API. *

* * @param attachTrafficSourcesRequest * @return A Java Future containing the result of the AttachTrafficSources 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.AttachTrafficSources * @see AWS API Documentation */ @Override public CompletableFuture attachTrafficSources( AttachTrafficSourcesRequest attachTrafficSourcesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(attachTrafficSourcesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, attachTrafficSourcesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AttachTrafficSources"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(AttachTrafficSourcesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("AttachTrafficSources").withProtocolMetadata(protocolMetadata) .withMarshaller(new AttachTrafficSourcesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(attachTrafficSourcesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes one or more scheduled actions for the specified Auto Scaling group. *

* * @param batchDeleteScheduledActionRequest * @return A Java Future containing the result of the BatchDeleteScheduledAction 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.BatchDeleteScheduledAction * @see AWS API Documentation */ @Override public CompletableFuture batchDeleteScheduledAction( BatchDeleteScheduledActionRequest batchDeleteScheduledActionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(batchDeleteScheduledActionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, batchDeleteScheduledActionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchDeleteScheduledAction"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(BatchDeleteScheduledActionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("BatchDeleteScheduledAction").withProtocolMetadata(protocolMetadata) .withMarshaller(new BatchDeleteScheduledActionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(batchDeleteScheduledActionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates or updates one or more scheduled scaling actions for an Auto Scaling group. *

* * @param batchPutScheduledUpdateGroupActionRequest * @return A Java Future containing the result of the BatchPutScheduledUpdateGroupAction 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. *
    *
  • AlreadyExistsException You already have an Auto Scaling group or launch configuration with this name. *
  • *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.BatchPutScheduledUpdateGroupAction * @see AWS API Documentation */ @Override public CompletableFuture batchPutScheduledUpdateGroupAction( BatchPutScheduledUpdateGroupActionRequest batchPutScheduledUpdateGroupActionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(batchPutScheduledUpdateGroupActionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, batchPutScheduledUpdateGroupActionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchPutScheduledUpdateGroupAction"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(BatchPutScheduledUpdateGroupActionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("BatchPutScheduledUpdateGroupAction").withProtocolMetadata(protocolMetadata) .withMarshaller(new BatchPutScheduledUpdateGroupActionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(batchPutScheduledUpdateGroupActionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Cancels an instance refresh or rollback that is in progress. If an instance refresh or rollback is not in * progress, an ActiveInstanceRefreshNotFound error occurs. *

*

* This operation is part of the instance refresh * feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you * make configuration changes. *

*

* When you cancel an instance refresh, this does not roll back any changes that it made. Use the RollbackInstanceRefresh API to roll back instead. *

* * @param cancelInstanceRefreshRequest * @return A Java Future containing the result of the CancelInstanceRefresh 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. *
    *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ActiveInstanceRefreshNotFoundException The request failed because an active instance refresh or * rollback for the specified Auto Scaling group was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.CancelInstanceRefresh * @see AWS API Documentation */ @Override public CompletableFuture cancelInstanceRefresh( CancelInstanceRefreshRequest cancelInstanceRefreshRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(cancelInstanceRefreshRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelInstanceRefreshRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelInstanceRefresh"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(CancelInstanceRefreshResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CancelInstanceRefresh").withProtocolMetadata(protocolMetadata) .withMarshaller(new CancelInstanceRefreshRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(cancelInstanceRefreshRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Completes the lifecycle action for the specified token or instance with the specified result. *

*

* This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group: *

*
    *
  1. *

    * (Optional) Create a launch template or launch configuration with a user data script that runs while an instance * is in a wait state due to a lifecycle hook. *

    *
  2. *
  3. *

    * (Optional) Create a Lambda function and a rule that allows Amazon EventBridge to invoke your Lambda function when * an instance is put into a wait state due to a lifecycle hook. *

    *
  4. *
  5. *

    * (Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an * Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target. *

    *
  6. *
  7. *

    * Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate. *

    *
  8. *
  9. *

    * If you need more time, record the lifecycle action heartbeat to keep the instance in a wait state. *

    *
  10. *
  11. *

    * If you finish before the timeout period ends, send a callback by using the CompleteLifecycleAction API call. *

    *
  12. *
*

* For more information, see Complete a lifecycle * action in the Amazon EC2 Auto Scaling User Guide. *

* * @param completeLifecycleActionRequest * @return A Java Future containing the result of the CompleteLifecycleAction 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.CompleteLifecycleAction * @see AWS API Documentation */ @Override public CompletableFuture completeLifecycleAction( CompleteLifecycleActionRequest completeLifecycleActionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(completeLifecycleActionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, completeLifecycleActionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CompleteLifecycleAction"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(CompleteLifecycleActionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CompleteLifecycleAction").withProtocolMetadata(protocolMetadata) .withMarshaller(new CompleteLifecycleActionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(completeLifecycleActionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* We strongly recommend using a launch template when calling this operation to ensure full functionality for * Amazon EC2 Auto Scaling and Amazon EC2. *

*

* Creates an Auto Scaling group with the specified name and attributes. *

*

* If you exceed your maximum limit of Auto Scaling groups, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Quotas for Amazon EC2 * Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

*

* If you're new to Amazon EC2 Auto Scaling, see the introductory tutorials in Get started * with Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

*

* Every Auto Scaling group has three size properties (DesiredCapacity, MaxSize, and * MinSize). Usually, you set these sizes based on a specific number of instances. However, if you * configure a mixed instances policy that defines weights for the instance types, you must specify these sizes with * the same units that you use for weighting instances. *

* * @param createAutoScalingGroupRequest * @return A Java Future containing the result of the CreateAutoScalingGroup 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. *
    *
  • AlreadyExistsException You already have an Auto Scaling group or launch configuration with this name. *
  • *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.CreateAutoScalingGroup * @see AWS API Documentation */ @Override public CompletableFuture createAutoScalingGroup( CreateAutoScalingGroupRequest createAutoScalingGroupRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createAutoScalingGroupRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createAutoScalingGroupRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAutoScalingGroup"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(CreateAutoScalingGroupResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateAutoScalingGroup").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateAutoScalingGroupRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createAutoScalingGroupRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates a launch configuration. *

*

* If you exceed your maximum limit of launch configurations, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Quotas for Amazon EC2 * Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

*

* For more information, see Launch configurations * in the Amazon EC2 Auto Scaling User Guide. *

* *

* Amazon EC2 Auto Scaling configures instances launched as part of an Auto Scaling group using either a launch * template or a launch configuration. We strongly recommend that you do not use launch configurations. They do not * provide full functionality for Amazon EC2 Auto Scaling or Amazon EC2. For information about using launch * templates, see Launch * templates in the Amazon EC2 Auto Scaling User Guide. *

*
* * @param createLaunchConfigurationRequest * @return A Java Future containing the result of the CreateLaunchConfiguration 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. *
    *
  • AlreadyExistsException You already have an Auto Scaling group or launch configuration with this name. *
  • *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.CreateLaunchConfiguration * @see AWS API Documentation */ @Override public CompletableFuture createLaunchConfiguration( CreateLaunchConfigurationRequest createLaunchConfigurationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createLaunchConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createLaunchConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateLaunchConfiguration"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(CreateLaunchConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateLaunchConfiguration").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateLaunchConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createLaunchConfigurationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates or updates tags for the specified Auto Scaling group. *

*

* When you specify a tag with a key that already exists, the operation overwrites the previous tag definition, and * you do not get an error message. *

*

* For more information, see Tag Auto Scaling * groups and instances in the Amazon EC2 Auto Scaling User Guide. *

* * @param createOrUpdateTagsRequest * @return A Java Future containing the result of the CreateOrUpdateTags 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. *
    *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • AlreadyExistsException You already have an Auto Scaling group or launch configuration with this name. *
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ResourceInUseException The operation can't be performed because the resource is in use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.CreateOrUpdateTags * @see AWS API Documentation */ @Override public CompletableFuture createOrUpdateTags(CreateOrUpdateTagsRequest createOrUpdateTagsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createOrUpdateTagsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createOrUpdateTagsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateOrUpdateTags"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(CreateOrUpdateTagsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateOrUpdateTags").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateOrUpdateTagsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createOrUpdateTagsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified Auto Scaling group. *

*

* If the group has instances or scaling activities in progress, you must specify the option to force the deletion * in order for it to succeed. The force delete operation will also terminate the EC2 instances. If the group has a * warm pool, the force delete option also deletes the warm pool. *

*

* To remove instances from the Auto Scaling group before deleting it, call the DetachInstances API * with the list of instances and the option to decrement the desired capacity. This ensures that Amazon EC2 Auto * Scaling does not launch replacement instances. *

*

* To terminate all instances before deleting the Auto Scaling group, call the UpdateAutoScalingGroup API and set the minimum size and desired capacity of the Auto Scaling group to zero. *

*

* If the group has scaling policies, deleting the group deletes the policies, the underlying alarm actions, and any * alarm that no longer has an associated action. *

*

* For more information, see Delete your Auto Scaling * infrastructure in the Amazon EC2 Auto Scaling User Guide. *

* * @param deleteAutoScalingGroupRequest * @return A Java Future containing the result of the DeleteAutoScalingGroup 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. *
    *
  • ScalingActivityInProgressException The operation can't be performed because there are scaling * activities in progress.
  • *
  • ResourceInUseException The operation can't be performed because the resource is in use.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DeleteAutoScalingGroup * @see AWS API Documentation */ @Override public CompletableFuture deleteAutoScalingGroup( DeleteAutoScalingGroupRequest deleteAutoScalingGroupRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAutoScalingGroupRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAutoScalingGroupRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAutoScalingGroup"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DeleteAutoScalingGroupResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteAutoScalingGroup").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteAutoScalingGroupRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteAutoScalingGroupRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified launch configuration. *

*

* The launch configuration must not be attached to an Auto Scaling group. When this call completes, the launch * configuration is no longer available for use. *

* * @param deleteLaunchConfigurationRequest * @return A Java Future containing the result of the DeleteLaunchConfiguration 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. *
    *
  • ResourceInUseException The operation can't be performed because the resource is in use.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DeleteLaunchConfiguration * @see AWS API Documentation */ @Override public CompletableFuture deleteLaunchConfiguration( DeleteLaunchConfigurationRequest deleteLaunchConfigurationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteLaunchConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteLaunchConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteLaunchConfiguration"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DeleteLaunchConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteLaunchConfiguration").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteLaunchConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteLaunchConfigurationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified lifecycle hook. *

*

* If there are any outstanding lifecycle actions, they are completed first (ABANDON for launching * instances, CONTINUE for terminating instances). *

* * @param deleteLifecycleHookRequest * @return A Java Future containing the result of the DeleteLifecycleHook 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DeleteLifecycleHook * @see AWS API Documentation */ @Override public CompletableFuture deleteLifecycleHook( DeleteLifecycleHookRequest deleteLifecycleHookRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteLifecycleHookRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteLifecycleHookRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteLifecycleHook"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DeleteLifecycleHookResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteLifecycleHook").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteLifecycleHookRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteLifecycleHookRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified notification. *

* * @param deleteNotificationConfigurationRequest * @return A Java Future containing the result of the DeleteNotificationConfiguration 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DeleteNotificationConfiguration * @see AWS API Documentation */ @Override public CompletableFuture deleteNotificationConfiguration( DeleteNotificationConfigurationRequest deleteNotificationConfigurationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteNotificationConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteNotificationConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteNotificationConfiguration"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DeleteNotificationConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteNotificationConfiguration").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteNotificationConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteNotificationConfigurationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified scaling policy. *

*

* Deleting either a step scaling policy or a simple scaling policy deletes the underlying alarm action, but does * not delete the alarm, even if it no longer has an associated action. *

*

* For more information, see Delete a scaling * policy in the Amazon EC2 Auto Scaling User Guide. *

* * @param deletePolicyRequest * @return A Java Future containing the result of the DeletePolicy 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DeletePolicy * @see AWS API * Documentation */ @Override public CompletableFuture deletePolicy(DeletePolicyRequest deletePolicyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deletePolicyRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deletePolicyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeletePolicy"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DeletePolicyResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeletePolicy").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeletePolicyRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deletePolicyRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified scheduled action. *

* * @param deleteScheduledActionRequest * @return A Java Future containing the result of the DeleteScheduledAction 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DeleteScheduledAction * @see AWS API Documentation */ @Override public CompletableFuture deleteScheduledAction( DeleteScheduledActionRequest deleteScheduledActionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteScheduledActionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteScheduledActionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteScheduledAction"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DeleteScheduledActionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteScheduledAction").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteScheduledActionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteScheduledActionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified tags. *

* * @param deleteTagsRequest * @return A Java Future containing the result of the DeleteTags 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ResourceInUseException The operation can't be performed because the resource is in use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DeleteTags * @see AWS API * Documentation */ @Override public CompletableFuture deleteTags(DeleteTagsRequest deleteTagsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteTagsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteTagsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteTags"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DeleteTagsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams().withOperationName("DeleteTags") .withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteTagsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteTagsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the warm pool for the specified Auto Scaling group. *

*

* For more information, see Warm pools for * Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @param deleteWarmPoolRequest * @return A Java Future containing the result of the DeleteWarmPool 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. *
    *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ScalingActivityInProgressException The operation can't be performed because there are scaling * activities in progress.
  • *
  • ResourceInUseException The operation can't be performed because the resource is in use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DeleteWarmPool * @see AWS * API Documentation */ @Override public CompletableFuture deleteWarmPool(DeleteWarmPoolRequest deleteWarmPoolRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteWarmPoolRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteWarmPoolRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteWarmPool"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DeleteWarmPoolResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteWarmPool").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteWarmPoolRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteWarmPoolRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the current Amazon EC2 Auto Scaling resource quotas for your account. *

*

* When you establish an Amazon Web Services account, the account has initial quotas on the maximum number of Auto * Scaling groups and launch configurations that you can create in a given Region. For more information, see Quotas for Amazon EC2 * Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @param describeAccountLimitsRequest * @return A Java Future containing the result of the DescribeAccountLimits 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeAccountLimits * @see AWS API Documentation */ @Override public CompletableFuture describeAccountLimits( DescribeAccountLimitsRequest describeAccountLimitsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAccountLimitsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAccountLimitsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAccountLimits"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeAccountLimitsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAccountLimits").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeAccountLimitsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeAccountLimitsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the available adjustment types for step scaling and simple scaling policies. *

*

* The following adjustment types are supported: *

*
    *
  • *

    * ChangeInCapacity *

    *
  • *
  • *

    * ExactCapacity *

    *
  • *
  • *

    * PercentChangeInCapacity *

    *
  • *
* * @param describeAdjustmentTypesRequest * @return A Java Future containing the result of the DescribeAdjustmentTypes 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeAdjustmentTypes * @see AWS API Documentation */ @Override public CompletableFuture describeAdjustmentTypes( DescribeAdjustmentTypesRequest describeAdjustmentTypesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAdjustmentTypesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAdjustmentTypesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAdjustmentTypes"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeAdjustmentTypesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAdjustmentTypes").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeAdjustmentTypesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeAdjustmentTypesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about the Auto Scaling groups in the account and Region. *

*

* If you specify Auto Scaling group names, the output includes information for only the specified Auto Scaling * groups. If you specify filters, the output includes information for only those Auto Scaling groups that meet the * filter criteria. If you do not specify group names or filters, the output includes information for all Auto * Scaling groups. *

*

* This operation also returns information about instances in Auto Scaling groups. To retrieve information about the * instances in a warm pool, you must call the DescribeWarmPool * API. *

* * @param describeAutoScalingGroupsRequest * @return A Java Future containing the result of the DescribeAutoScalingGroups 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. *
    *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeAutoScalingGroups * @see AWS API Documentation */ @Override public CompletableFuture describeAutoScalingGroups( DescribeAutoScalingGroupsRequest describeAutoScalingGroupsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAutoScalingGroupsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAutoScalingGroupsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAutoScalingGroups"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeAutoScalingGroupsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAutoScalingGroups").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeAutoScalingGroupsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeAutoScalingGroupsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about the Auto Scaling instances in the account and Region. *

* * @param describeAutoScalingInstancesRequest * @return A Java Future containing the result of the DescribeAutoScalingInstances 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. *
    *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeAutoScalingInstances * @see AWS API Documentation */ @Override public CompletableFuture describeAutoScalingInstances( DescribeAutoScalingInstancesRequest describeAutoScalingInstancesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAutoScalingInstancesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAutoScalingInstancesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAutoScalingInstances"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeAutoScalingInstancesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAutoScalingInstances").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeAutoScalingInstancesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeAutoScalingInstancesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the notification types that are supported by Amazon EC2 Auto Scaling. *

* * @param describeAutoScalingNotificationTypesRequest * @return A Java Future containing the result of the DescribeAutoScalingNotificationTypes 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeAutoScalingNotificationTypes * @see AWS API Documentation */ @Override public CompletableFuture describeAutoScalingNotificationTypes( DescribeAutoScalingNotificationTypesRequest describeAutoScalingNotificationTypesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAutoScalingNotificationTypesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAutoScalingNotificationTypesRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAutoScalingNotificationTypes"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeAutoScalingNotificationTypesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAutoScalingNotificationTypes").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeAutoScalingNotificationTypesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeAutoScalingNotificationTypesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about the instance refreshes for the specified Auto Scaling group from the previous six weeks. *

*

* This operation is part of the instance refresh * feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you * make configuration changes. *

*

* To help you determine the status of an instance refresh, Amazon EC2 Auto Scaling returns information about the * instance refreshes you previously initiated, including their status, start time, end time, the percentage of the * instance refresh that is complete, and the number of instances remaining to update before the instance refresh is * complete. If a rollback is initiated while an instance refresh is in progress, Amazon EC2 Auto Scaling also * returns information about the rollback of the instance refresh. *

* * @param describeInstanceRefreshesRequest * @return A Java Future containing the result of the DescribeInstanceRefreshes 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. *
    *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeInstanceRefreshes * @see AWS API Documentation */ @Override public CompletableFuture describeInstanceRefreshes( DescribeInstanceRefreshesRequest describeInstanceRefreshesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeInstanceRefreshesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeInstanceRefreshesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeInstanceRefreshes"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeInstanceRefreshesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeInstanceRefreshes").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeInstanceRefreshesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeInstanceRefreshesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about the launch configurations in the account and Region. *

* * @param describeLaunchConfigurationsRequest * @return A Java Future containing the result of the DescribeLaunchConfigurations 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. *
    *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeLaunchConfigurations * @see AWS API Documentation */ @Override public CompletableFuture describeLaunchConfigurations( DescribeLaunchConfigurationsRequest describeLaunchConfigurationsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeLaunchConfigurationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeLaunchConfigurationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeLaunchConfigurations"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeLaunchConfigurationsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeLaunchConfigurations").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeLaunchConfigurationsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeLaunchConfigurationsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the available types of lifecycle hooks. *

*

* The following hook types are supported: *

*
    *
  • *

    * autoscaling:EC2_INSTANCE_LAUNCHING *

    *
  • *
  • *

    * autoscaling:EC2_INSTANCE_TERMINATING *

    *
  • *
* * @param describeLifecycleHookTypesRequest * @return A Java Future containing the result of the DescribeLifecycleHookTypes 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeLifecycleHookTypes * @see AWS API Documentation */ @Override public CompletableFuture describeLifecycleHookTypes( DescribeLifecycleHookTypesRequest describeLifecycleHookTypesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeLifecycleHookTypesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeLifecycleHookTypesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeLifecycleHookTypes"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeLifecycleHookTypesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeLifecycleHookTypes").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeLifecycleHookTypesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeLifecycleHookTypesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about the lifecycle hooks for the specified Auto Scaling group. *

* * @param describeLifecycleHooksRequest * @return A Java Future containing the result of the DescribeLifecycleHooks 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeLifecycleHooks * @see AWS API Documentation */ @Override public CompletableFuture describeLifecycleHooks( DescribeLifecycleHooksRequest describeLifecycleHooksRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeLifecycleHooksRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeLifecycleHooksRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeLifecycleHooks"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeLifecycleHooksResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeLifecycleHooks").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeLifecycleHooksRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeLifecycleHooksRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** * *

* This API operation is superseded by DescribeTrafficSources, which can describe multiple traffic sources types. We recommend using * DetachTrafficSources to simplify how you manage traffic sources. However, we continue to support * DescribeLoadBalancerTargetGroups. You can use both the original * DescribeLoadBalancerTargetGroups API operation and DescribeTrafficSources on the same * Auto Scaling group. *

*
*

* Gets information about the Elastic Load Balancing target groups for the specified Auto Scaling group. *

*

* To determine the attachment status of the target group, use the State element in the response. When * you attach a target group to an Auto Scaling group, the initial State value is Adding. * The state transitions to Added after all Auto Scaling instances are registered with the target * group. If Elastic Load Balancing health checks are enabled for the Auto Scaling group, the state transitions to * InService after at least one Auto Scaling instance passes the health check. When the target group is * in the InService state, Amazon EC2 Auto Scaling can terminate and replace any instances that are * reported as unhealthy. If no registered instances pass the health checks, the target group doesn't enter the * InService state. *

*

* Target groups also have an InService state if you attach them in the CreateAutoScalingGroup API call. If your target group state is InService, but it is not working * properly, check the scaling activities by calling DescribeScalingActivities and take any corrective actions necessary. *

*

* For help with failed health checks, see Troubleshooting Amazon EC2 * Auto Scaling: Health checks in the Amazon EC2 Auto Scaling User Guide. For more information, see Use Elastic Load * Balancing to distribute traffic across the instances in your Auto Scaling group in the Amazon EC2 Auto * Scaling User Guide. *

* *

* You can use this operation to describe target groups that were attached by using AttachLoadBalancerTargetGroups, but not for target groups that were attached by using AttachTrafficSources. *

*
* * @param describeLoadBalancerTargetGroupsRequest * @return A Java Future containing the result of the DescribeLoadBalancerTargetGroups 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeLoadBalancerTargetGroups * @see AWS API Documentation */ @Override public CompletableFuture describeLoadBalancerTargetGroups( DescribeLoadBalancerTargetGroupsRequest describeLoadBalancerTargetGroupsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeLoadBalancerTargetGroupsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeLoadBalancerTargetGroupsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeLoadBalancerTargetGroups"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeLoadBalancerTargetGroupsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeLoadBalancerTargetGroups").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeLoadBalancerTargetGroupsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeLoadBalancerTargetGroupsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** * *

* This API operation is superseded by DescribeTrafficSources, which can describe multiple traffic sources types. We recommend using * DescribeTrafficSources to simplify how you manage traffic sources. However, we continue to support * DescribeLoadBalancers. You can use both the original DescribeLoadBalancers API * operation and DescribeTrafficSources on the same Auto Scaling group. *

*
*

* Gets information about the load balancers for the specified Auto Scaling group. *

*

* This operation describes only Classic Load Balancers. If you have Application Load Balancers, Network Load * Balancers, or Gateway Load Balancers, use the DescribeLoadBalancerTargetGroups API instead. *

*

* To determine the attachment status of the load balancer, use the State element in the response. When * you attach a load balancer to an Auto Scaling group, the initial State value is Adding. * The state transitions to Added after all Auto Scaling instances are registered with the load * balancer. If Elastic Load Balancing health checks are enabled for the Auto Scaling group, the state transitions * to InService after at least one Auto Scaling instance passes the health check. When the load * balancer is in the InService state, Amazon EC2 Auto Scaling can terminate and replace any instances * that are reported as unhealthy. If no registered instances pass the health checks, the load balancer doesn't * enter the InService state. *

*

* Load balancers also have an InService state if you attach them in the CreateAutoScalingGroup API call. If your load balancer state is InService, but it is not * working properly, check the scaling activities by calling DescribeScalingActivities and take any corrective actions necessary. *

*

* For help with failed health checks, see Troubleshooting Amazon EC2 * Auto Scaling: Health checks in the Amazon EC2 Auto Scaling User Guide. For more information, see Use Elastic Load * Balancing to distribute traffic across the instances in your Auto Scaling group in the Amazon EC2 Auto * Scaling User Guide. *

* * @param describeLoadBalancersRequest * @return A Java Future containing the result of the DescribeLoadBalancers 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeLoadBalancers * @see AWS API Documentation */ @Override public CompletableFuture describeLoadBalancers( DescribeLoadBalancersRequest describeLoadBalancersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeLoadBalancersRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeLoadBalancersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeLoadBalancers"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeLoadBalancersResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeLoadBalancers").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeLoadBalancersRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeLoadBalancersRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the available CloudWatch metrics for Amazon EC2 Auto Scaling. *

* * @param describeMetricCollectionTypesRequest * @return A Java Future containing the result of the DescribeMetricCollectionTypes 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeMetricCollectionTypes * @see AWS API Documentation */ @Override public CompletableFuture describeMetricCollectionTypes( DescribeMetricCollectionTypesRequest describeMetricCollectionTypesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeMetricCollectionTypesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeMetricCollectionTypesRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeMetricCollectionTypes"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeMetricCollectionTypesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeMetricCollectionTypes").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeMetricCollectionTypesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeMetricCollectionTypesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about the Amazon SNS notifications that are configured for one or more Auto Scaling groups. *

* * @param describeNotificationConfigurationsRequest * @return A Java Future containing the result of the DescribeNotificationConfigurations 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. *
    *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeNotificationConfigurations * @see AWS API Documentation */ @Override public CompletableFuture describeNotificationConfigurations( DescribeNotificationConfigurationsRequest describeNotificationConfigurationsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeNotificationConfigurationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeNotificationConfigurationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeNotificationConfigurations"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeNotificationConfigurationsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeNotificationConfigurations").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeNotificationConfigurationsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeNotificationConfigurationsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about the scaling policies in the account and Region. *

* * @param describePoliciesRequest * @return A Java Future containing the result of the DescribePolicies 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. *
    *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribePolicies * @see AWS * API Documentation */ @Override public CompletableFuture describePolicies(DescribePoliciesRequest describePoliciesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describePoliciesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describePoliciesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribePolicies"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribePoliciesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribePolicies").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribePoliciesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describePoliciesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about the scaling activities in the account and Region. *

*

* When scaling events occur, you see a record of the scaling activity in the scaling activities. For more * information, see Verify a scaling * activity for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. *

*

* If the scaling event succeeds, the value of the StatusCode element in the response is * Successful. If an attempt to launch instances failed, the StatusCode value is * Failed or Cancelled and the StatusMessage element in the response * indicates the cause of the failure. For help interpreting the StatusMessage, see Troubleshooting Amazon EC2 * Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @param describeScalingActivitiesRequest * @return A Java Future containing the result of the DescribeScalingActivities 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. *
    *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeScalingActivities * @see AWS API Documentation */ @Override public CompletableFuture describeScalingActivities( DescribeScalingActivitiesRequest describeScalingActivitiesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeScalingActivitiesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeScalingActivitiesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeScalingActivities"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeScalingActivitiesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeScalingActivities").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeScalingActivitiesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeScalingActivitiesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the scaling process types for use with the ResumeProcesses and * SuspendProcesses * APIs. *

* * @param describeScalingProcessTypesRequest * @return A Java Future containing the result of the DescribeScalingProcessTypes 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeScalingProcessTypes * @see AWS API Documentation */ @Override public CompletableFuture describeScalingProcessTypes( DescribeScalingProcessTypesRequest describeScalingProcessTypesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeScalingProcessTypesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeScalingProcessTypesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeScalingProcessTypes"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeScalingProcessTypesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeScalingProcessTypes").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeScalingProcessTypesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeScalingProcessTypesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about the scheduled actions that haven't run or that have not reached their end time. *

*

* To describe the scaling activities for scheduled actions that have already run, call the DescribeScalingActivities API. *

* * @param describeScheduledActionsRequest * @return A Java Future containing the result of the DescribeScheduledActions 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. *
    *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeScheduledActions * @see AWS API Documentation */ @Override public CompletableFuture describeScheduledActions( DescribeScheduledActionsRequest describeScheduledActionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeScheduledActionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeScheduledActionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeScheduledActions"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeScheduledActionsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeScheduledActions").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeScheduledActionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeScheduledActionsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the specified tags. *

*

* You can use filters to limit the results. For example, you can query for the tags for a specific Auto Scaling * group. You can specify multiple values for a filter. A tag must match at least one of the specified values for it * to be included in the results. *

*

* You can also specify multiple filters. The result includes information for a particular tag only if it matches * all the filters. If there's no match, no special message is returned. *

*

* For more information, see Tag Auto Scaling * groups and instances in the Amazon EC2 Auto Scaling User Guide. *

* * @param describeTagsRequest * @return A Java Future containing the result of the DescribeTags 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. *
    *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeTags * @see AWS API * Documentation */ @Override public CompletableFuture describeTags(DescribeTagsRequest describeTagsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeTagsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeTagsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeTags"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeTagsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeTags").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeTagsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeTagsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the termination policies supported by Amazon EC2 Auto Scaling. *

*

* For more information, see Configure * termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @param describeTerminationPolicyTypesRequest * @return A Java Future containing the result of the DescribeTerminationPolicyTypes 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeTerminationPolicyTypes * @see AWS API Documentation */ @Override public CompletableFuture describeTerminationPolicyTypes( DescribeTerminationPolicyTypesRequest describeTerminationPolicyTypesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeTerminationPolicyTypesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeTerminationPolicyTypesRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeTerminationPolicyTypes"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeTerminationPolicyTypesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeTerminationPolicyTypes").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeTerminationPolicyTypesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeTerminationPolicyTypesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about the traffic sources for the specified Auto Scaling group. *

*

* You can optionally provide a traffic source type. If you provide a traffic source type, then the results only * include that traffic source type. *

*

* If you do not provide a traffic source type, then the results include all the traffic sources for the specified * Auto Scaling group. *

* * @param describeTrafficSourcesRequest * @return A Java Future containing the result of the DescribeTrafficSources 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeTrafficSources * @see AWS API Documentation */ @Override public CompletableFuture describeTrafficSources( DescribeTrafficSourcesRequest describeTrafficSourcesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeTrafficSourcesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeTrafficSourcesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeTrafficSources"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeTrafficSourcesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeTrafficSources").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeTrafficSourcesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeTrafficSourcesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets information about a warm pool and its instances. *

*

* For more information, see Warm pools for * Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @param describeWarmPoolRequest * @return A Java Future containing the result of the DescribeWarmPool 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. *
    *
  • InvalidNextTokenException The NextToken value is not valid.
  • *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DescribeWarmPool * @see AWS * API Documentation */ @Override public CompletableFuture describeWarmPool(DescribeWarmPoolRequest describeWarmPoolRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeWarmPoolRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeWarmPoolRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeWarmPool"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DescribeWarmPoolResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeWarmPool").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeWarmPoolRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeWarmPoolRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Removes one or more instances from the specified Auto Scaling group. *

*

* After the instances are detached, you can manage them independent of the Auto Scaling group. *

*

* If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to * replace the ones that are detached. *

*

* If there is a Classic Load Balancer attached to the Auto Scaling group, the instances are deregistered from the * load balancer. If there are target groups attached to the Auto Scaling group, the instances are deregistered from * the target groups. *

*

* For more information, see Detach * or attach instances in the Amazon EC2 Auto Scaling User Guide. *

* * @param detachInstancesRequest * @return A Java Future containing the result of the DetachInstances 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DetachInstances * @see AWS * API Documentation */ @Override public CompletableFuture detachInstances(DetachInstancesRequest detachInstancesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(detachInstancesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, detachInstancesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DetachInstances"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DetachInstancesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DetachInstances").withProtocolMetadata(protocolMetadata) .withMarshaller(new DetachInstancesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(detachInstancesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** * *

* This API operation is superseded by DetachTrafficSources, which can detach multiple traffic sources types. We recommend using * DetachTrafficSources to simplify how you manage traffic sources. However, we continue to support * DetachLoadBalancerTargetGroups. You can use both the original * DetachLoadBalancerTargetGroups API operation and DetachTrafficSources on the same Auto * Scaling group. *

*
*

* Detaches one or more target groups from the specified Auto Scaling group. *

*

* When you detach a target group, it enters the Removing state while deregistering the instances in * the group. When all instances are deregistered, then you can no longer describe the target group using the * DescribeLoadBalancerTargetGroups API call. The instances remain running. *

* *

* You can use this operation to detach target groups that were attached by using AttachLoadBalancerTargetGroups, but not for target groups that were attached by using AttachTrafficSources. *

*
* * @param detachLoadBalancerTargetGroupsRequest * @return A Java Future containing the result of the DetachLoadBalancerTargetGroups 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DetachLoadBalancerTargetGroups * @see AWS API Documentation */ @Override public CompletableFuture detachLoadBalancerTargetGroups( DetachLoadBalancerTargetGroupsRequest detachLoadBalancerTargetGroupsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(detachLoadBalancerTargetGroupsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, detachLoadBalancerTargetGroupsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DetachLoadBalancerTargetGroups"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DetachLoadBalancerTargetGroupsResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DetachLoadBalancerTargetGroups").withProtocolMetadata(protocolMetadata) .withMarshaller(new DetachLoadBalancerTargetGroupsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(detachLoadBalancerTargetGroupsRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** * *

* This API operation is superseded by DetachTrafficSources, which can detach multiple traffic sources types. We recommend using * DetachTrafficSources to simplify how you manage traffic sources. However, we continue to support * DetachLoadBalancers. You can use both the original DetachLoadBalancers API operation * and DetachTrafficSources on the same Auto Scaling group. *

*
*

* Detaches one or more Classic Load Balancers from the specified Auto Scaling group. *

*

* This operation detaches only Classic Load Balancers. If you have Application Load Balancers, Network Load * Balancers, or Gateway Load Balancers, use the DetachLoadBalancerTargetGroups API instead. *

*

* When you detach a load balancer, it enters the Removing state while deregistering the instances in * the group. When all instances are deregistered, then you can no longer describe the load balancer using the DescribeLoadBalancers * API call. The instances remain running. *

* * @param detachLoadBalancersRequest * @return A Java Future containing the result of the DetachLoadBalancers 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DetachLoadBalancers * @see AWS API Documentation */ @Override public CompletableFuture detachLoadBalancers( DetachLoadBalancersRequest detachLoadBalancersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(detachLoadBalancersRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, detachLoadBalancersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DetachLoadBalancers"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DetachLoadBalancersResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DetachLoadBalancers").withProtocolMetadata(protocolMetadata) .withMarshaller(new DetachLoadBalancersRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(detachLoadBalancersRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Detaches one or more traffic sources from the specified Auto Scaling group. *

*

* When you detach a traffic source, it enters the Removing state while deregistering the instances in * the group. When all instances are deregistered, then you can no longer describe the traffic source using the * DescribeTrafficSources API call. The instances continue to run. *

* * @param detachTrafficSourcesRequest * @return A Java Future containing the result of the DetachTrafficSources 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DetachTrafficSources * @see AWS API Documentation */ @Override public CompletableFuture detachTrafficSources( DetachTrafficSourcesRequest detachTrafficSourcesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(detachTrafficSourcesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, detachTrafficSourcesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DetachTrafficSources"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DetachTrafficSourcesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DetachTrafficSources").withProtocolMetadata(protocolMetadata) .withMarshaller(new DetachTrafficSourcesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(detachTrafficSourcesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Disables group metrics collection for the specified Auto Scaling group. *

* * @param disableMetricsCollectionRequest * @return A Java Future containing the result of the DisableMetricsCollection 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.DisableMetricsCollection * @see AWS API Documentation */ @Override public CompletableFuture disableMetricsCollection( DisableMetricsCollectionRequest disableMetricsCollectionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(disableMetricsCollectionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, disableMetricsCollectionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisableMetricsCollection"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(DisableMetricsCollectionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DisableMetricsCollection").withProtocolMetadata(protocolMetadata) .withMarshaller(new DisableMetricsCollectionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(disableMetricsCollectionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Enables group metrics collection for the specified Auto Scaling group. *

*

* You can use these metrics to track changes in an Auto Scaling group and to set alarms on threshold values. You * can view group metrics using the Amazon EC2 Auto Scaling console or the CloudWatch console. For more information, * see * Monitor CloudWatch metrics for your Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User * Guide. *

* * @param enableMetricsCollectionRequest * @return A Java Future containing the result of the EnableMetricsCollection 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.EnableMetricsCollection * @see AWS API Documentation */ @Override public CompletableFuture enableMetricsCollection( EnableMetricsCollectionRequest enableMetricsCollectionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(enableMetricsCollectionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, enableMetricsCollectionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EnableMetricsCollection"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(EnableMetricsCollectionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("EnableMetricsCollection").withProtocolMetadata(protocolMetadata) .withMarshaller(new EnableMetricsCollectionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(enableMetricsCollectionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Moves the specified instances into the standby state. *

*

* If you choose to decrement the desired capacity of the Auto Scaling group, the instances can enter standby as * long as the desired capacity of the Auto Scaling group after the instances are placed into standby is equal to or * greater than the minimum capacity of the group. *

*

* If you choose not to decrement the desired capacity of the Auto Scaling group, the Auto Scaling group launches * new instances to replace the instances on standby. *

*

* For more information, see Temporarily removing * instances from your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. *

* * @param enterStandbyRequest * @return A Java Future containing the result of the EnterStandby 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.EnterStandby * @see AWS API * Documentation */ @Override public CompletableFuture enterStandby(EnterStandbyRequest enterStandbyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(enterStandbyRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, enterStandbyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EnterStandby"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(EnterStandbyResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("EnterStandby").withProtocolMetadata(protocolMetadata) .withMarshaller(new EnterStandbyRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(enterStandbyRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Executes the specified policy. This can be useful for testing the design of your scaling policy. *

* * @param executePolicyRequest * @return A Java Future containing the result of the ExecutePolicy 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. *
    *
  • ScalingActivityInProgressException The operation can't be performed because there are scaling * activities in progress.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.ExecutePolicy * @see AWS API * Documentation */ @Override public CompletableFuture executePolicy(ExecutePolicyRequest executePolicyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(executePolicyRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, executePolicyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExecutePolicy"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(ExecutePolicyResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ExecutePolicy").withProtocolMetadata(protocolMetadata) .withMarshaller(new ExecutePolicyRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(executePolicyRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Moves the specified instances out of the standby state. *

*

* After you put the instances back in service, the desired capacity is incremented. *

*

* For more information, see Temporarily removing * instances from your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. *

* * @param exitStandbyRequest * @return A Java Future containing the result of the ExitStandby 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.ExitStandby * @see AWS API * Documentation */ @Override public CompletableFuture exitStandby(ExitStandbyRequest exitStandbyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exitStandbyRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exitStandbyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExitStandby"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(ExitStandbyResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ExitStandby").withProtocolMetadata(protocolMetadata) .withMarshaller(new ExitStandbyRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(exitStandbyRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Retrieves the forecast data for a predictive scaling policy. *

*

* Load forecasts are predictions of the hourly load values using historical load data from CloudWatch and an * analysis of historical trends. Capacity forecasts are represented as predicted values for the minimum capacity * that is needed on an hourly basis, based on the hourly load forecast. *

*

* A minimum of 24 hours of data is required to create the initial forecasts. However, having a full 14 days of * historical data results in more accurate forecasts. *

*

* For more information, see Predictive * scaling for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @param getPredictiveScalingForecastRequest * @return A Java Future containing the result of the GetPredictiveScalingForecast 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.GetPredictiveScalingForecast * @see AWS API Documentation */ @Override public CompletableFuture getPredictiveScalingForecast( GetPredictiveScalingForecastRequest getPredictiveScalingForecastRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getPredictiveScalingForecastRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getPredictiveScalingForecastRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetPredictiveScalingForecast"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(GetPredictiveScalingForecastResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetPredictiveScalingForecast").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetPredictiveScalingForecastRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getPredictiveScalingForecastRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates or updates a lifecycle hook for the specified Auto Scaling group. *

*

* Lifecycle hooks let you create solutions that are aware of events in the Auto Scaling instance lifecycle, and * then perform a custom action on instances when the corresponding lifecycle event occurs. *

*

* This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group: *

*
    *
  1. *

    * (Optional) Create a launch template or launch configuration with a user data script that runs while an instance * is in a wait state due to a lifecycle hook. *

    *
  2. *
  3. *

    * (Optional) Create a Lambda function and a rule that allows Amazon EventBridge to invoke your Lambda function when * an instance is put into a wait state due to a lifecycle hook. *

    *
  4. *
  5. *

    * (Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an * Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target. *

    *
  6. *
  7. *

    * Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate. *

    *
  8. *
  9. *

    * If you need more time, record the lifecycle action heartbeat to keep the instance in a wait state using the * RecordLifecycleActionHeartbeat API call. *

    *
  10. *
  11. *

    * If you finish before the timeout period ends, send a callback by using the CompleteLifecycleAction API call. *

    *
  12. *
*

* For more information, see Amazon EC2 Auto Scaling * lifecycle hooks in the Amazon EC2 Auto Scaling User Guide. *

*

* If you exceed your maximum limit of lifecycle hooks, which by default is 50 per Auto Scaling group, the call * fails. *

*

* You can view the lifecycle hooks for an Auto Scaling group using the DescribeLifecycleHooks API call. If you are no longer using a lifecycle hook, you can delete it by calling * the * DeleteLifecycleHook API. *

* * @param putLifecycleHookRequest * @return A Java Future containing the result of the PutLifecycleHook 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. *
    *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.PutLifecycleHook * @see AWS * API Documentation */ @Override public CompletableFuture putLifecycleHook(PutLifecycleHookRequest putLifecycleHookRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putLifecycleHookRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putLifecycleHookRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutLifecycleHook"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutLifecycleHookResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("PutLifecycleHook").withProtocolMetadata(protocolMetadata) .withMarshaller(new PutLifecycleHookRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(putLifecycleHookRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Configures an Auto Scaling group to send notifications when specified events take place. Subscribers to the * specified topic can have messages delivered to an endpoint such as a web server or an email address. *

*

* This configuration overwrites any existing configuration. *

*

* For more information, see Amazon SNS * notification options for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

*

* If you exceed your maximum limit of SNS topics, which is 10 per Auto Scaling group, the call fails. *

* * @param putNotificationConfigurationRequest * @return A Java Future containing the result of the PutNotificationConfiguration 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. *
    *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.PutNotificationConfiguration * @see AWS API Documentation */ @Override public CompletableFuture putNotificationConfiguration( PutNotificationConfigurationRequest putNotificationConfigurationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putNotificationConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putNotificationConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutNotificationConfiguration"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutNotificationConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("PutNotificationConfiguration").withProtocolMetadata(protocolMetadata) .withMarshaller(new PutNotificationConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(putNotificationConfigurationRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates or updates a scaling policy for an Auto Scaling group. Scaling policies are used to scale an Auto Scaling * group based on configurable metrics. If no policies are defined, the dynamic scaling and predictive scaling * features are not used. *

*

* For more information about using dynamic scaling, see Target tracking * scaling policies and Step and simple scaling * policies in the Amazon EC2 Auto Scaling User Guide. *

*

* For more information about using predictive scaling, see Predictive * scaling for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

*

* You can view the scaling policies for an Auto Scaling group using the DescribePolicies * API call. If you are no longer using a scaling policy, you can delete it by calling the DeletePolicy API. *

* * @param putScalingPolicyRequest * @return A Java Future containing the result of the PutScalingPolicy 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. *
    *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.PutScalingPolicy * @see AWS * API Documentation */ @Override public CompletableFuture putScalingPolicy(PutScalingPolicyRequest putScalingPolicyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putScalingPolicyRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putScalingPolicyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutScalingPolicy"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutScalingPolicyResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("PutScalingPolicy").withProtocolMetadata(protocolMetadata) .withMarshaller(new PutScalingPolicyRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(putScalingPolicyRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates or updates a scheduled scaling action for an Auto Scaling group. *

*

* For more information, see Scheduled * scaling in the Amazon EC2 Auto Scaling User Guide. *

*

* You can view the scheduled actions for an Auto Scaling group using the DescribeScheduledActions API call. If you are no longer using a scheduled action, you can delete it by * calling the * DeleteScheduledAction API. *

*

* If you try to schedule your action in the past, Amazon EC2 Auto Scaling returns an error message. *

* * @param putScheduledUpdateGroupActionRequest * @return A Java Future containing the result of the PutScheduledUpdateGroupAction 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. *
    *
  • AlreadyExistsException You already have an Auto Scaling group or launch configuration with this name. *
  • *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.PutScheduledUpdateGroupAction * @see AWS API Documentation */ @Override public CompletableFuture putScheduledUpdateGroupAction( PutScheduledUpdateGroupActionRequest putScheduledUpdateGroupActionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putScheduledUpdateGroupActionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putScheduledUpdateGroupActionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutScheduledUpdateGroupAction"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutScheduledUpdateGroupActionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("PutScheduledUpdateGroupAction").withProtocolMetadata(protocolMetadata) .withMarshaller(new PutScheduledUpdateGroupActionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(putScheduledUpdateGroupActionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates or updates a warm pool for the specified Auto Scaling group. A warm pool is a pool of pre-initialized EC2 * instances that sits alongside the Auto Scaling group. Whenever your application needs to scale out, the Auto * Scaling group can draw on the warm pool to meet its new desired capacity. *

*

* This operation must be called from the Region in which the Auto Scaling group was created. *

*

* You can view the instances in the warm pool using the DescribeWarmPool * API call. If you are no longer using a warm pool, you can delete it by calling the DeleteWarmPool API. *

*

* For more information, see Warm pools for * Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @param putWarmPoolRequest * @return A Java Future containing the result of the PutWarmPool 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. *
    *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.PutWarmPool * @see AWS API * Documentation */ @Override public CompletableFuture putWarmPool(PutWarmPoolRequest putWarmPoolRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putWarmPoolRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putWarmPoolRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutWarmPool"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(PutWarmPoolResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("PutWarmPool").withProtocolMetadata(protocolMetadata) .withMarshaller(new PutWarmPoolRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(putWarmPoolRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Records a heartbeat for the lifecycle action associated with the specified token or instance. This extends the * timeout by the length of time defined using the PutLifecycleHook * API call. *

*

* This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group: *

*
    *
  1. *

    * (Optional) Create a launch template or launch configuration with a user data script that runs while an instance * is in a wait state due to a lifecycle hook. *

    *
  2. *
  3. *

    * (Optional) Create a Lambda function and a rule that allows Amazon EventBridge to invoke your Lambda function when * an instance is put into a wait state due to a lifecycle hook. *

    *
  4. *
  5. *

    * (Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an * Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target. *

    *
  6. *
  7. *

    * Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate. *

    *
  8. *
  9. *

    * If you need more time, record the lifecycle action heartbeat to keep the instance in a wait state. *

    *
  10. *
  11. *

    * If you finish before the timeout period ends, send a callback by using the CompleteLifecycleAction API call. *

    *
  12. *
*

* For more information, see Amazon EC2 Auto Scaling * lifecycle hooks in the Amazon EC2 Auto Scaling User Guide. *

* * @param recordLifecycleActionHeartbeatRequest * @return A Java Future containing the result of the RecordLifecycleActionHeartbeat 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.RecordLifecycleActionHeartbeat * @see AWS API Documentation */ @Override public CompletableFuture recordLifecycleActionHeartbeat( RecordLifecycleActionHeartbeatRequest recordLifecycleActionHeartbeatRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(recordLifecycleActionHeartbeatRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, recordLifecycleActionHeartbeatRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RecordLifecycleActionHeartbeat"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(RecordLifecycleActionHeartbeatResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("RecordLifecycleActionHeartbeat").withProtocolMetadata(protocolMetadata) .withMarshaller(new RecordLifecycleActionHeartbeatRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(recordLifecycleActionHeartbeatRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Resumes the specified suspended auto scaling processes, or all suspended process, for the specified Auto Scaling * group. *

*

* For more information, see Suspend and resume * Amazon EC2 Auto Scaling processes in the Amazon EC2 Auto Scaling User Guide. *

* * @param resumeProcessesRequest * @return A Java Future containing the result of the ResumeProcesses 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. *
    *
  • ResourceInUseException The operation can't be performed because the resource is in use.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.ResumeProcesses * @see AWS * API Documentation */ @Override public CompletableFuture resumeProcesses(ResumeProcessesRequest resumeProcessesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(resumeProcessesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, resumeProcessesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ResumeProcesses"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(ResumeProcessesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ResumeProcesses").withProtocolMetadata(protocolMetadata) .withMarshaller(new ResumeProcessesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(resumeProcessesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Cancels an instance refresh that is in progress and rolls back any changes that it made. Amazon EC2 Auto Scaling * replaces any instances that were replaced during the instance refresh. This restores your Auto Scaling group to * the configuration that it was using before the start of the instance refresh. *

*

* This operation is part of the instance refresh * feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you * make configuration changes. *

*

* A rollback is not supported in the following situations: *

*
    *
  • *

    * There is no desired configuration specified for the instance refresh. *

    *
  • *
  • *

    * The Auto Scaling group has a launch template that uses an Amazon Web Services Systems Manager parameter instead * of an AMI ID for the ImageId property. *

    *
  • *
  • *

    * The Auto Scaling group uses the launch template's $Latest or $Default version. *

    *
  • *
*

* When you receive a successful response from this operation, Amazon EC2 Auto Scaling immediately begins replacing * instances. You can check the status of this operation through the DescribeInstanceRefreshes API operation. *

* * @param rollbackInstanceRefreshRequest * @return A Java Future containing the result of the RollbackInstanceRefresh 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. *
    *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ActiveInstanceRefreshNotFoundException The request failed because an active instance refresh or * rollback for the specified Auto Scaling group was not found.
  • *
  • IrreversibleInstanceRefreshException The request failed because a desired configuration was not found * or an incompatible launch template (uses a Systems Manager parameter instead of an AMI ID) or launch * template version ($Latest or $Default) is present on the Auto Scaling * group.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.RollbackInstanceRefresh * @see AWS API Documentation */ @Override public CompletableFuture rollbackInstanceRefresh( RollbackInstanceRefreshRequest rollbackInstanceRefreshRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rollbackInstanceRefreshRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rollbackInstanceRefreshRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RollbackInstanceRefresh"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(RollbackInstanceRefreshResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("RollbackInstanceRefresh").withProtocolMetadata(protocolMetadata) .withMarshaller(new RollbackInstanceRefreshRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(rollbackInstanceRefreshRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Sets the size of the specified Auto Scaling group. *

*

* If a scale-in activity occurs as a result of a new DesiredCapacity value that is lower than the * current size of the group, the Auto Scaling group uses its termination policy to determine which instances to * terminate. *

*

* For more information, see Manual * scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @param setDesiredCapacityRequest * @return A Java Future containing the result of the SetDesiredCapacity 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. *
    *
  • ScalingActivityInProgressException The operation can't be performed because there are scaling * activities in progress.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.SetDesiredCapacity * @see AWS API Documentation */ @Override public CompletableFuture setDesiredCapacity(SetDesiredCapacityRequest setDesiredCapacityRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(setDesiredCapacityRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, setDesiredCapacityRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SetDesiredCapacity"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(SetDesiredCapacityResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("SetDesiredCapacity").withProtocolMetadata(protocolMetadata) .withMarshaller(new SetDesiredCapacityRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(setDesiredCapacityRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Sets the health status of the specified instance. *

*

* For more information, see Set up a custom * health check for your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. *

* * @param setInstanceHealthRequest * @return A Java Future containing the result of the SetInstanceHealth 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. *
    *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.SetInstanceHealth * @see AWS * API Documentation */ @Override public CompletableFuture setInstanceHealth(SetInstanceHealthRequest setInstanceHealthRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(setInstanceHealthRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, setInstanceHealthRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SetInstanceHealth"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(SetInstanceHealthResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("SetInstanceHealth").withProtocolMetadata(protocolMetadata) .withMarshaller(new SetInstanceHealthRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(setInstanceHealthRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates the instance protection settings of the specified instances. This operation cannot be called on instances * in a warm pool. *

*

* For more information, see Use * instance scale-in protection in the Amazon EC2 Auto Scaling User Guide. *

*

* If you exceed your maximum limit of instance IDs, which is 50 per Auto Scaling group, the call fails. *

* * @param setInstanceProtectionRequest * @return A Java Future containing the result of the SetInstanceProtection 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. *
    *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.SetInstanceProtection * @see AWS API Documentation */ @Override public CompletableFuture setInstanceProtection( SetInstanceProtectionRequest setInstanceProtectionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(setInstanceProtectionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, setInstanceProtectionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SetInstanceProtection"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(SetInstanceProtectionResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("SetInstanceProtection").withProtocolMetadata(protocolMetadata) .withMarshaller(new SetInstanceProtectionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(setInstanceProtectionRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Starts an instance refresh. *

*

* This operation is part of the instance refresh * feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group. This feature * is helpful, for example, when you have a new AMI or a new user data script. You just need to create a new launch * template that specifies the new AMI or user data script. Then start an instance refresh to immediately begin the * process of updating instances in the group. *

*

* If successful, the request's response contains a unique ID that you can use to track the progress of the instance * refresh. To query its status, call the DescribeInstanceRefreshes API. To describe the instance refreshes that have already run, call the DescribeInstanceRefreshes API. To cancel an instance refresh that is in progress, use the CancelInstanceRefresh API. *

*

* An instance refresh might fail for several reasons, such as EC2 launch failures, misconfigured health checks, or * not ignoring or allowing the termination of instances that are in Standby state or protected from * scale in. You can monitor for failed EC2 launches using the scaling activities. To find the scaling activities, * call the * DescribeScalingActivities API. *

*

* If you enable auto rollback, your Auto Scaling group will be rolled back automatically when the instance refresh * fails. You can enable this feature before starting an instance refresh by specifying the * AutoRollback property in the instance refresh preferences. Otherwise, to roll back an instance * refresh before it finishes, use the RollbackInstanceRefresh API. *

* * @param startInstanceRefreshRequest * @return A Java Future containing the result of the StartInstanceRefresh 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. *
    *
  • LimitExceededException You have already reached a limit for your Amazon EC2 Auto Scaling resources * (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see * * DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • InstanceRefreshInProgressException The request failed because an active instance refresh already * exists for the specified Auto Scaling group.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.StartInstanceRefresh * @see AWS API Documentation */ @Override public CompletableFuture startInstanceRefresh( StartInstanceRefreshRequest startInstanceRefreshRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startInstanceRefreshRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startInstanceRefreshRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartInstanceRefresh"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(StartInstanceRefreshResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StartInstanceRefresh").withProtocolMetadata(protocolMetadata) .withMarshaller(new StartInstanceRefreshRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(startInstanceRefreshRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Suspends the specified auto scaling processes, or all processes, for the specified Auto Scaling group. *

*

* If you suspend either the Launch or Terminate process types, it can prevent other * process types from functioning properly. For more information, see Suspend and resume * Amazon EC2 Auto Scaling processes in the Amazon EC2 Auto Scaling User Guide. *

*

* To resume processes that have been suspended, call the ResumeProcesses API. *

* * @param suspendProcessesRequest * @return A Java Future containing the result of the SuspendProcesses 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. *
    *
  • ResourceInUseException The operation can't be performed because the resource is in use.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.SuspendProcesses * @see AWS * API Documentation */ @Override public CompletableFuture suspendProcesses(SuspendProcessesRequest suspendProcessesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(suspendProcessesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, suspendProcessesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SuspendProcesses"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(SuspendProcessesResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("SuspendProcesses").withProtocolMetadata(protocolMetadata) .withMarshaller(new SuspendProcessesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(suspendProcessesRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Terminates the specified instance and optionally adjusts the desired group size. This operation cannot be called * on instances in a warm pool. *

*

* This call simply makes a termination request. The instance is not terminated immediately. When an instance is * terminated, the instance status changes to terminated. You can't connect to or start an instance * after you've terminated it. *

*

* If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to * replace the ones that are terminated. *

*

* By default, Amazon EC2 Auto Scaling balances instances across all Availability Zones. If you decrement the * desired capacity, your Auto Scaling group can become unbalanced between Availability Zones. Amazon EC2 Auto * Scaling tries to rebalance the group, and rebalancing might terminate instances in other zones. For more * information, see Manual * scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @param terminateInstanceInAutoScalingGroupRequest * @return A Java Future containing the result of the TerminateInstanceInAutoScalingGroup 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. *
    *
  • ScalingActivityInProgressException The operation can't be performed because there are scaling * activities in progress.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.TerminateInstanceInAutoScalingGroup * @see AWS API Documentation */ @Override public CompletableFuture terminateInstanceInAutoScalingGroup( TerminateInstanceInAutoScalingGroupRequest terminateInstanceInAutoScalingGroupRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(terminateInstanceInAutoScalingGroupRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, terminateInstanceInAutoScalingGroupRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TerminateInstanceInAutoScalingGroup"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(TerminateInstanceInAutoScalingGroupResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("TerminateInstanceInAutoScalingGroup").withProtocolMetadata(protocolMetadata) .withMarshaller(new TerminateInstanceInAutoScalingGroupRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(terminateInstanceInAutoScalingGroupRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* We strongly recommend that all Auto Scaling groups use launch templates to ensure full functionality for * Amazon EC2 Auto Scaling and Amazon EC2. *

*

* Updates the configuration for the specified Auto Scaling group. *

*

* To update an Auto Scaling group, specify the name of the group and the property that you want to change. Any * properties that you don't specify are not changed by this update request. The new settings take effect on any * scaling activities after this call returns. *

*

* If you associate a new launch configuration or template with an Auto Scaling group, all new instances will get * the updated configuration. Existing instances continue to run with the configuration that they were originally * launched with. When you update a group to specify a mixed instances policy instead of a launch configuration or * template, existing instances may be replaced to match the new purchasing options that you specified in the * policy. For example, if the group currently has 100% On-Demand capacity and the policy specifies 50% Spot * capacity, this means that half of your instances will be gradually terminated and relaunched as Spot Instances. * When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones, so that * updating your group does not compromise the performance or availability of your application. *

*

* Note the following about changing DesiredCapacity, MaxSize, or MinSize: *

*
    *
  • *

    * If a scale-in activity occurs as a result of a new DesiredCapacity value that is lower than the * current size of the group, the Auto Scaling group uses its termination policy to determine which instances to * terminate. *

    *
  • *
  • *

    * If you specify a new value for MinSize without specifying a value for DesiredCapacity, * and the new MinSize is larger than the current size of the group, this sets the group's * DesiredCapacity to the new MinSize value. *

    *
  • *
  • *

    * If you specify a new value for MaxSize without specifying a value for DesiredCapacity, * and the new MaxSize is smaller than the current size of the group, this sets the group's * DesiredCapacity to the new MaxSize value. *

    *
  • *
*

* To see which properties have been set, call the DescribeAutoScalingGroups API. To view the scaling policies for an Auto Scaling group, call the DescribePolicies * API. If the group has scaling policies, you can update them by calling the PutScalingPolicy * API. *

* * @param updateAutoScalingGroupRequest * @return A Java Future containing the result of the UpdateAutoScalingGroup 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. *
    *
  • ScalingActivityInProgressException The operation can't be performed because there are scaling * activities in progress.
  • *
  • ResourceContentionException You already have a pending update to an Amazon EC2 Auto Scaling resource * (for example, an Auto Scaling group, instance, or load balancer).
  • *
  • ServiceLinkedRoleFailureException The service-linked role is not yet ready for use.
  • *
  • 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.
  • *
  • AutoScalingException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AutoScalingAsyncClient.UpdateAutoScalingGroup * @see AWS API Documentation */ @Override public CompletableFuture updateAutoScalingGroup( UpdateAutoScalingGroupRequest updateAutoScalingGroupRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateAutoScalingGroupRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateAutoScalingGroupRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Auto Scaling"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateAutoScalingGroup"); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(UpdateAutoScalingGroupResponse::builder); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateAutoScalingGroup").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateAutoScalingGroupRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateAutoScalingGroupRequest)); CompletableFuture whenCompleteFuture = null; whenCompleteFuture = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture); } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } @Override public AutoScalingAsyncWaiter waiter() { return AutoScalingAsyncWaiter.builder().client(this).scheduledExecutorService(executorService).build(); } @Override public final AutoScalingServiceClientConfiguration serviceClientConfiguration() { return new AutoScalingServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public final String serviceName() { return SERVICE_NAME; } private AwsQueryProtocolFactory init() { return AwsQueryProtocolFactory .builder() .registerModeledException( ExceptionMetadata.builder().errorCode("InstanceRefreshInProgress") .exceptionBuilderSupplier(InstanceRefreshInProgressException::builder).httpStatusCode(400) .build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ScalingActivityInProgress") .exceptionBuilderSupplier(ScalingActivityInProgressException::builder).httpStatusCode(400) .build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidNextToken") .exceptionBuilderSupplier(InvalidNextTokenException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("LimitExceeded") .exceptionBuilderSupplier(LimitExceededException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("AlreadyExists") .exceptionBuilderSupplier(AlreadyExistsException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ActiveInstanceRefreshNotFound") .exceptionBuilderSupplier(ActiveInstanceRefreshNotFoundException::builder).httpStatusCode(400) .build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceContention") .exceptionBuilderSupplier(ResourceContentionException::builder).httpStatusCode(500).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceLinkedRoleFailure") .exceptionBuilderSupplier(ServiceLinkedRoleFailureException::builder).httpStatusCode(500).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceInUse") .exceptionBuilderSupplier(ResourceInUseException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("IrreversibleInstanceRefresh") .exceptionBuilderSupplier(IrreversibleInstanceRefreshException::builder).httpStatusCode(400) .build()).clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(AutoScalingException::builder).build(); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); if (retryMode != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode)); } else { Consumer> configurator = builder.retryStrategyConfigurator(); if (configurator != null) { RetryStrategy.Builder defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder(); configurator.accept(defaultBuilder); configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build()); } else { RetryStrategy retryStrategy = builder.retryStrategy(); if (retryStrategy != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy); } } } configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null); } private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) { List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList()); SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder(); if (plugins.isEmpty()) { return configuration.build(); } AutoScalingServiceClientConfigurationBuilder serviceConfigBuilder = new AutoScalingServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } updateRetryStrategyClientConfiguration(configuration); return configuration.build(); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy