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

software.amazon.awssdk.services.autoscaling.model.UpdateAutoScalingGroupRequest 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

There is a newer version: 2.29.15
Show 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.model;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class UpdateAutoScalingGroupRequest extends AutoScalingRequest implements
        ToCopyableBuilder {
    private static final SdkField AUTO_SCALING_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("AutoScalingGroupName").getter(getter(UpdateAutoScalingGroupRequest::autoScalingGroupName))
            .setter(setter(Builder::autoScalingGroupName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoScalingGroupName").build())
            .build();

    private static final SdkField LAUNCH_CONFIGURATION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("LaunchConfigurationName").getter(getter(UpdateAutoScalingGroupRequest::launchConfigurationName))
            .setter(setter(Builder::launchConfigurationName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LaunchConfigurationName").build())
            .build();

    private static final SdkField LAUNCH_TEMPLATE_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("LaunchTemplate")
            .getter(getter(UpdateAutoScalingGroupRequest::launchTemplate)).setter(setter(Builder::launchTemplate))
            .constructor(LaunchTemplateSpecification::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LaunchTemplate").build()).build();

    private static final SdkField MIXED_INSTANCES_POLICY_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("MixedInstancesPolicy")
            .getter(getter(UpdateAutoScalingGroupRequest::mixedInstancesPolicy)).setter(setter(Builder::mixedInstancesPolicy))
            .constructor(MixedInstancesPolicy::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MixedInstancesPolicy").build())
            .build();

    private static final SdkField MIN_SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("MinSize").getter(getter(UpdateAutoScalingGroupRequest::minSize)).setter(setter(Builder::minSize))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MinSize").build()).build();

    private static final SdkField MAX_SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("MaxSize").getter(getter(UpdateAutoScalingGroupRequest::maxSize)).setter(setter(Builder::maxSize))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxSize").build()).build();

    private static final SdkField DESIRED_CAPACITY_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("DesiredCapacity").getter(getter(UpdateAutoScalingGroupRequest::desiredCapacity))
            .setter(setter(Builder::desiredCapacity))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DesiredCapacity").build()).build();

    private static final SdkField DEFAULT_COOLDOWN_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("DefaultCooldown").getter(getter(UpdateAutoScalingGroupRequest::defaultCooldown))
            .setter(setter(Builder::defaultCooldown))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultCooldown").build()).build();

    private static final SdkField> AVAILABILITY_ZONES_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("AvailabilityZones")
            .getter(getter(UpdateAutoScalingGroupRequest::availabilityZones))
            .setter(setter(Builder::availabilityZones))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZones").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField HEALTH_CHECK_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("HealthCheckType").getter(getter(UpdateAutoScalingGroupRequest::healthCheckType))
            .setter(setter(Builder::healthCheckType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HealthCheckType").build()).build();

    private static final SdkField HEALTH_CHECK_GRACE_PERIOD_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("HealthCheckGracePeriod").getter(getter(UpdateAutoScalingGroupRequest::healthCheckGracePeriod))
            .setter(setter(Builder::healthCheckGracePeriod))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HealthCheckGracePeriod").build())
            .build();

    private static final SdkField PLACEMENT_GROUP_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("PlacementGroup").getter(getter(UpdateAutoScalingGroupRequest::placementGroup))
            .setter(setter(Builder::placementGroup))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PlacementGroup").build()).build();

    private static final SdkField VPC_ZONE_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("VPCZoneIdentifier").getter(getter(UpdateAutoScalingGroupRequest::vpcZoneIdentifier))
            .setter(setter(Builder::vpcZoneIdentifier))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VPCZoneIdentifier").build()).build();

    private static final SdkField> TERMINATION_POLICIES_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("TerminationPolicies")
            .getter(getter(UpdateAutoScalingGroupRequest::terminationPolicies))
            .setter(setter(Builder::terminationPolicies))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TerminationPolicies").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField NEW_INSTANCES_PROTECTED_FROM_SCALE_IN_FIELD = SdkField
            . builder(MarshallingType.BOOLEAN)
            .memberName("NewInstancesProtectedFromScaleIn")
            .getter(getter(UpdateAutoScalingGroupRequest::newInstancesProtectedFromScaleIn))
            .setter(setter(Builder::newInstancesProtectedFromScaleIn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NewInstancesProtectedFromScaleIn")
                    .build()).build();

    private static final SdkField SERVICE_LINKED_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ServiceLinkedRoleARN").getter(getter(UpdateAutoScalingGroupRequest::serviceLinkedRoleARN))
            .setter(setter(Builder::serviceLinkedRoleARN))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceLinkedRoleARN").build())
            .build();

    private static final SdkField MAX_INSTANCE_LIFETIME_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("MaxInstanceLifetime").getter(getter(UpdateAutoScalingGroupRequest::maxInstanceLifetime))
            .setter(setter(Builder::maxInstanceLifetime))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxInstanceLifetime").build())
            .build();

    private static final SdkField CAPACITY_REBALANCE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
            .memberName("CapacityRebalance").getter(getter(UpdateAutoScalingGroupRequest::capacityRebalance))
            .setter(setter(Builder::capacityRebalance))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CapacityRebalance").build()).build();

    private static final SdkField CONTEXT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Context")
            .getter(getter(UpdateAutoScalingGroupRequest::context)).setter(setter(Builder::context))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Context").build()).build();

    private static final SdkField DESIRED_CAPACITY_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("DesiredCapacityType").getter(getter(UpdateAutoScalingGroupRequest::desiredCapacityType))
            .setter(setter(Builder::desiredCapacityType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DesiredCapacityType").build())
            .build();

    private static final SdkField DEFAULT_INSTANCE_WARMUP_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("DefaultInstanceWarmup").getter(getter(UpdateAutoScalingGroupRequest::defaultInstanceWarmup))
            .setter(setter(Builder::defaultInstanceWarmup))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultInstanceWarmup").build())
            .build();

    private static final SdkField INSTANCE_MAINTENANCE_POLICY_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("InstanceMaintenancePolicy")
            .getter(getter(UpdateAutoScalingGroupRequest::instanceMaintenancePolicy))
            .setter(setter(Builder::instanceMaintenancePolicy)).constructor(InstanceMaintenancePolicy::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceMaintenancePolicy").build())
            .build();

    private static final SdkField AVAILABILITY_ZONE_DISTRIBUTION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO)
            .memberName("AvailabilityZoneDistribution")
            .getter(getter(UpdateAutoScalingGroupRequest::availabilityZoneDistribution))
            .setter(setter(Builder::availabilityZoneDistribution))
            .constructor(AvailabilityZoneDistribution::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZoneDistribution")
                    .build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTO_SCALING_GROUP_NAME_FIELD,
            LAUNCH_CONFIGURATION_NAME_FIELD, LAUNCH_TEMPLATE_FIELD, MIXED_INSTANCES_POLICY_FIELD, MIN_SIZE_FIELD, MAX_SIZE_FIELD,
            DESIRED_CAPACITY_FIELD, DEFAULT_COOLDOWN_FIELD, AVAILABILITY_ZONES_FIELD, HEALTH_CHECK_TYPE_FIELD,
            HEALTH_CHECK_GRACE_PERIOD_FIELD, PLACEMENT_GROUP_FIELD, VPC_ZONE_IDENTIFIER_FIELD, TERMINATION_POLICIES_FIELD,
            NEW_INSTANCES_PROTECTED_FROM_SCALE_IN_FIELD, SERVICE_LINKED_ROLE_ARN_FIELD, MAX_INSTANCE_LIFETIME_FIELD,
            CAPACITY_REBALANCE_FIELD, CONTEXT_FIELD, DESIRED_CAPACITY_TYPE_FIELD, DEFAULT_INSTANCE_WARMUP_FIELD,
            INSTANCE_MAINTENANCE_POLICY_FIELD, AVAILABILITY_ZONE_DISTRIBUTION_FIELD));

    private static final Map> SDK_NAME_TO_FIELD = Collections
            .unmodifiableMap(new HashMap>() {
                {
                    put("AutoScalingGroupName", AUTO_SCALING_GROUP_NAME_FIELD);
                    put("LaunchConfigurationName", LAUNCH_CONFIGURATION_NAME_FIELD);
                    put("LaunchTemplate", LAUNCH_TEMPLATE_FIELD);
                    put("MixedInstancesPolicy", MIXED_INSTANCES_POLICY_FIELD);
                    put("MinSize", MIN_SIZE_FIELD);
                    put("MaxSize", MAX_SIZE_FIELD);
                    put("DesiredCapacity", DESIRED_CAPACITY_FIELD);
                    put("DefaultCooldown", DEFAULT_COOLDOWN_FIELD);
                    put("AvailabilityZones", AVAILABILITY_ZONES_FIELD);
                    put("HealthCheckType", HEALTH_CHECK_TYPE_FIELD);
                    put("HealthCheckGracePeriod", HEALTH_CHECK_GRACE_PERIOD_FIELD);
                    put("PlacementGroup", PLACEMENT_GROUP_FIELD);
                    put("VPCZoneIdentifier", VPC_ZONE_IDENTIFIER_FIELD);
                    put("TerminationPolicies", TERMINATION_POLICIES_FIELD);
                    put("NewInstancesProtectedFromScaleIn", NEW_INSTANCES_PROTECTED_FROM_SCALE_IN_FIELD);
                    put("ServiceLinkedRoleARN", SERVICE_LINKED_ROLE_ARN_FIELD);
                    put("MaxInstanceLifetime", MAX_INSTANCE_LIFETIME_FIELD);
                    put("CapacityRebalance", CAPACITY_REBALANCE_FIELD);
                    put("Context", CONTEXT_FIELD);
                    put("DesiredCapacityType", DESIRED_CAPACITY_TYPE_FIELD);
                    put("DefaultInstanceWarmup", DEFAULT_INSTANCE_WARMUP_FIELD);
                    put("InstanceMaintenancePolicy", INSTANCE_MAINTENANCE_POLICY_FIELD);
                    put("AvailabilityZoneDistribution", AVAILABILITY_ZONE_DISTRIBUTION_FIELD);
                }
            });

    private final String autoScalingGroupName;

    private final String launchConfigurationName;

    private final LaunchTemplateSpecification launchTemplate;

    private final MixedInstancesPolicy mixedInstancesPolicy;

    private final Integer minSize;

    private final Integer maxSize;

    private final Integer desiredCapacity;

    private final Integer defaultCooldown;

    private final List availabilityZones;

    private final String healthCheckType;

    private final Integer healthCheckGracePeriod;

    private final String placementGroup;

    private final String vpcZoneIdentifier;

    private final List terminationPolicies;

    private final Boolean newInstancesProtectedFromScaleIn;

    private final String serviceLinkedRoleARN;

    private final Integer maxInstanceLifetime;

    private final Boolean capacityRebalance;

    private final String context;

    private final String desiredCapacityType;

    private final Integer defaultInstanceWarmup;

    private final InstanceMaintenancePolicy instanceMaintenancePolicy;

    private final AvailabilityZoneDistribution availabilityZoneDistribution;

    private UpdateAutoScalingGroupRequest(BuilderImpl builder) {
        super(builder);
        this.autoScalingGroupName = builder.autoScalingGroupName;
        this.launchConfigurationName = builder.launchConfigurationName;
        this.launchTemplate = builder.launchTemplate;
        this.mixedInstancesPolicy = builder.mixedInstancesPolicy;
        this.minSize = builder.minSize;
        this.maxSize = builder.maxSize;
        this.desiredCapacity = builder.desiredCapacity;
        this.defaultCooldown = builder.defaultCooldown;
        this.availabilityZones = builder.availabilityZones;
        this.healthCheckType = builder.healthCheckType;
        this.healthCheckGracePeriod = builder.healthCheckGracePeriod;
        this.placementGroup = builder.placementGroup;
        this.vpcZoneIdentifier = builder.vpcZoneIdentifier;
        this.terminationPolicies = builder.terminationPolicies;
        this.newInstancesProtectedFromScaleIn = builder.newInstancesProtectedFromScaleIn;
        this.serviceLinkedRoleARN = builder.serviceLinkedRoleARN;
        this.maxInstanceLifetime = builder.maxInstanceLifetime;
        this.capacityRebalance = builder.capacityRebalance;
        this.context = builder.context;
        this.desiredCapacityType = builder.desiredCapacityType;
        this.defaultInstanceWarmup = builder.defaultInstanceWarmup;
        this.instanceMaintenancePolicy = builder.instanceMaintenancePolicy;
        this.availabilityZoneDistribution = builder.availabilityZoneDistribution;
    }

    /**
     * 

* The name of the Auto Scaling group. *

* * @return The name of the Auto Scaling group. */ public final String autoScalingGroupName() { return autoScalingGroupName; } /** *

* The name of the launch configuration. If you specify LaunchConfigurationName in your update request, * you can't specify LaunchTemplate or MixedInstancesPolicy. *

* * @return The name of the launch configuration. If you specify LaunchConfigurationName in your update * request, you can't specify LaunchTemplate or MixedInstancesPolicy. */ public final String launchConfigurationName() { return launchConfigurationName; } /** *

* The launch template and version to use to specify the updates. If you specify LaunchTemplate in your * update request, you can't specify LaunchConfigurationName or MixedInstancesPolicy. *

* * @return The launch template and version to use to specify the updates. If you specify LaunchTemplate * in your update request, you can't specify LaunchConfigurationName or * MixedInstancesPolicy. */ public final LaunchTemplateSpecification launchTemplate() { return launchTemplate; } /** *

* The mixed instances policy. For more information, see Auto * Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User * Guide. *

* * @return The mixed instances policy. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto * Scaling User Guide. */ public final MixedInstancesPolicy mixedInstancesPolicy() { return mixedInstancesPolicy; } /** *

* The minimum size of the Auto Scaling group. *

* * @return The minimum size of the Auto Scaling group. */ public final Integer minSize() { return minSize; } /** *

* The maximum size of the Auto Scaling group. *

* *

* With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above * MaxSize to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go * above MaxSize by more than your largest instance weight (weights that define how many units each * instance contributes to the desired capacity of the group). *

*
* * @return The maximum size of the Auto Scaling group.

*

* With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above * MaxSize to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will * never go above MaxSize by more than your largest instance weight (weights that define how * many units each instance contributes to the desired capacity of the group). *

*/ public final Integer maxSize() { return maxSize; } /** *

* The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the * capacity it attempts to maintain. This number must be greater than or equal to the minimum size of the group and * less than or equal to the maximum size of the group. *

* * @return The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and * the capacity it attempts to maintain. This number must be greater than or equal to the minimum size of * the group and less than or equal to the maximum size of the group. */ public final Integer desiredCapacity() { return desiredCapacity; } /** *

* Only needed if you use simple scaling policies. *

*

* The amount of time, in seconds, between one scaling activity ending and another one starting due to simple * scaling policies. For more information, see Scaling * cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @return Only needed if you use simple scaling policies.

*

* The amount of time, in seconds, between one scaling activity ending and another one starting due to * simple scaling policies. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. */ public final Integer defaultCooldown() { return defaultCooldown; } /** * For responses, this returns true if the service returned a value for the AvailabilityZones property. This DOES * NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasAvailabilityZones() { return availabilityZones != null && !(availabilityZones instanceof SdkAutoConstructList); } /** *

* One or more Availability Zones for the group. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasAvailabilityZones} method. *

* * @return One or more Availability Zones for the group. */ public final List availabilityZones() { return availabilityZones; } /** *

* A comma-separated value string of one or more health check types. *

*

* The valid values are EC2, EBS, ELB, and VPC_LATTICE. * EC2 is the default health check and cannot be disabled. For more information, see Health checks * for instances in an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. *

*

* Only specify EC2 if you must clear a value that was previously set. *

* * @return A comma-separated value string of one or more health check types.

*

* The valid values are EC2, EBS, ELB, and VPC_LATTICE. * EC2 is the default health check and cannot be disabled. For more information, see Health * checks for instances in an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. *

*

* Only specify EC2 if you must clear a value that was previously set. */ public final String healthCheckType() { return healthCheckType; } /** *

* The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 * instance that has come into service and marking it unhealthy due to a failed health check. This is useful if your * instances do not immediately pass their health checks after they enter the InService state. For more * information, see Set the health check * grace period for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. *

* * @return The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of * an EC2 instance that has come into service and marking it unhealthy due to a failed health check. This is * useful if your instances do not immediately pass their health checks after they enter the * InService state. For more information, see Set the * health check grace period for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. */ public final Integer healthCheckGracePeriod() { return healthCheckGracePeriod; } /** *

* The name of an existing placement group into which to launch your instances. To remove the placement group * setting, pass an empty string for placement-group. For more information about placement groups, see * Placement groups in the * Amazon EC2 User Guide for Linux Instances. *

* *

* A cluster placement group is a logical grouping of instances within a single Availability Zone. You cannot * specify multiple Availability Zones and a cluster placement group. *

*
* * @return The name of an existing placement group into which to launch your instances. To remove the placement * group setting, pass an empty string for placement-group. For more information about * placement groups, see Placement groups in * the Amazon EC2 User Guide for Linux Instances.

*

* A cluster placement group is a logical grouping of instances within a single Availability Zone. * You cannot specify multiple Availability Zones and a cluster placement group. *

*/ public final String placementGroup() { return placementGroup; } /** *

* A comma-separated list of subnet IDs for a virtual private cloud (VPC). If you specify * VPCZoneIdentifier with AvailabilityZones, the subnets that you specify must reside in * those Availability Zones. *

* * @return A comma-separated list of subnet IDs for a virtual private cloud (VPC). If you specify * VPCZoneIdentifier with AvailabilityZones, the subnets that you specify must * reside in those Availability Zones. */ public final String vpcZoneIdentifier() { return vpcZoneIdentifier; } /** * For responses, this returns true if the service returned a value for the TerminationPolicies property. This DOES * NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasTerminationPolicies() { return terminationPolicies != null && !(terminationPolicies instanceof SdkAutoConstructList); } /** *

* A policy or a list of policies that are used to select the instances to terminate. The policies are executed in * the order that you list them. For more information, see Configure * termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

*

* Valid values: Default | AllocationStrategy | ClosestToNextInstanceHour | * NewestInstance | OldestInstance | OldestLaunchConfiguration | * OldestLaunchTemplate | arn:aws:lambda:region:account-id:function:my-function:my-alias *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasTerminationPolicies} method. *

* * @return A policy or a list of policies that are used to select the instances to terminate. The policies are * executed in the order that you list them. For more information, see Configure termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User * Guide.

*

* Valid values: Default | AllocationStrategy | * ClosestToNextInstanceHour | NewestInstance | OldestInstance | * OldestLaunchConfiguration | OldestLaunchTemplate | * arn:aws:lambda:region:account-id:function:my-function:my-alias */ public final List terminationPolicies() { return terminationPolicies; } /** *

* Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling * in. For more information about preventing instances from terminating on scale in, see Use * instance scale-in protection in the Amazon EC2 Auto Scaling User Guide. *

* * @return Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when * scaling in. For more information about preventing instances from terminating on scale in, see Use instance scale-in protection in the Amazon EC2 Auto Scaling User Guide. */ public final Boolean newInstancesProtectedFromScaleIn() { return newInstancesProtectedFromScaleIn; } /** *

* The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other Amazon * Web Services on your behalf. For more information, see Service-linked * roles in the Amazon EC2 Auto Scaling User Guide. *

* * @return The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other * Amazon Web Services on your behalf. For more information, see Service-linked roles in the Amazon EC2 Auto Scaling User Guide. */ public final String serviceLinkedRoleARN() { return serviceLinkedRoleARN; } /** *

* The maximum amount of time, in seconds, that an instance can be in service. The default is null. If specified, * the value must be either 0 or a number equal to or greater than 86,400 seconds (1 day). To clear a previously set * value, specify a new value of 0. For more information, see Replacing Auto * Scaling instances based on maximum instance lifetime in the Amazon EC2 Auto Scaling User Guide. *

* * @return The maximum amount of time, in seconds, that an instance can be in service. The default is null. If * specified, the value must be either 0 or a number equal to or greater than 86,400 seconds (1 day). To * clear a previously set value, specify a new value of 0. For more information, see Replacing * Auto Scaling instances based on maximum instance lifetime in the Amazon EC2 Auto Scaling User * Guide. */ public final Integer maxInstanceLifetime() { return maxInstanceLifetime; } /** *

* Enables or disables Capacity Rebalancing. For more information, see Use * Capacity Rebalancing to handle Amazon EC2 Spot Interruptions in the Amazon EC2 Auto Scaling User * Guide. *

* * @return Enables or disables Capacity Rebalancing. For more information, see Use Capacity Rebalancing to handle Amazon EC2 Spot Interruptions in the Amazon EC2 Auto Scaling * User Guide. */ public final Boolean capacityRebalance() { return capacityRebalance; } /** *

* Reserved. *

* * @return Reserved. */ public final String context() { return context; } /** *

* The unit of measurement for the value specified for desired capacity. Amazon EC2 Auto Scaling supports * DesiredCapacityType for attribute-based instance type selection only. For more information, see Create a mixed instances group using attribute-based instance type selection in the Amazon EC2 Auto * Scaling User Guide. *

*

* By default, Amazon EC2 Auto Scaling specifies units, which translates into number of instances. *

*

* Valid values: units | vcpu | memory-mib *

* * @return The unit of measurement for the value specified for desired capacity. Amazon EC2 Auto Scaling supports * DesiredCapacityType for attribute-based instance type selection only. For more information, * see Create a mixed instances group using attribute-based instance type selection in the Amazon EC2 * Auto Scaling User Guide.

*

* By default, Amazon EC2 Auto Scaling specifies units, which translates into number of * instances. *

*

* Valid values: units | vcpu | memory-mib */ public final String desiredCapacityType() { return desiredCapacityType; } /** *

* The amount of time, in seconds, until a new instance is considered to have finished initializing and resource * consumption to become stable after it enters the InService state. *

*

* During an instance refresh, Amazon EC2 Auto Scaling waits for the warm-up period after it replaces an instance * before it moves on to replacing the next instance. Amazon EC2 Auto Scaling also waits for the warm-up period * before aggregating the metrics for new instances with existing instances in the Amazon CloudWatch metrics that * are used for scaling, resulting in more reliable usage data. For more information, see Set * the default instance warmup for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. *

* *

* To manage various warm-up settings at the group level, we recommend that you set the default instance warmup, * even if it is set to 0 seconds. To remove a value that you previously set, include the property but * specify -1 for the value. However, we strongly recommend keeping the default instance warmup enabled * by specifying a value of 0 or other nominal value. *

*
* * @return The amount of time, in seconds, until a new instance is considered to have finished initializing and * resource consumption to become stable after it enters the InService state.

*

* During an instance refresh, Amazon EC2 Auto Scaling waits for the warm-up period after it replaces an * instance before it moves on to replacing the next instance. Amazon EC2 Auto Scaling also waits for the * warm-up period before aggregating the metrics for new instances with existing instances in the Amazon * CloudWatch metrics that are used for scaling, resulting in more reliable usage data. For more * information, see Set * the default instance warmup for an Auto Scaling group in the Amazon EC2 Auto Scaling User * Guide. *

* *

* To manage various warm-up settings at the group level, we recommend that you set the default instance * warmup, even if it is set to 0 seconds. To remove a value that you previously set, include the * property but specify -1 for the value. However, we strongly recommend keeping the default * instance warmup enabled by specifying a value of 0 or other nominal value. *

*/ public final Integer defaultInstanceWarmup() { return defaultInstanceWarmup; } /** *

* An instance maintenance policy. For more information, see Set instance maintenance policy in the Amazon EC2 Auto Scaling User Guide. *

* * @return An instance maintenance policy. For more information, see Set instance maintenance policy in the Amazon EC2 Auto Scaling User Guide. */ public final InstanceMaintenancePolicy instanceMaintenancePolicy() { return instanceMaintenancePolicy; } /** *

* The instance capacity distribution across Availability Zones. *

* * @return The instance capacity distribution across Availability Zones. */ public final AvailabilityZoneDistribution availabilityZoneDistribution() { return availabilityZoneDistribution; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(autoScalingGroupName()); hashCode = 31 * hashCode + Objects.hashCode(launchConfigurationName()); hashCode = 31 * hashCode + Objects.hashCode(launchTemplate()); hashCode = 31 * hashCode + Objects.hashCode(mixedInstancesPolicy()); hashCode = 31 * hashCode + Objects.hashCode(minSize()); hashCode = 31 * hashCode + Objects.hashCode(maxSize()); hashCode = 31 * hashCode + Objects.hashCode(desiredCapacity()); hashCode = 31 * hashCode + Objects.hashCode(defaultCooldown()); hashCode = 31 * hashCode + Objects.hashCode(hasAvailabilityZones() ? availabilityZones() : null); hashCode = 31 * hashCode + Objects.hashCode(healthCheckType()); hashCode = 31 * hashCode + Objects.hashCode(healthCheckGracePeriod()); hashCode = 31 * hashCode + Objects.hashCode(placementGroup()); hashCode = 31 * hashCode + Objects.hashCode(vpcZoneIdentifier()); hashCode = 31 * hashCode + Objects.hashCode(hasTerminationPolicies() ? terminationPolicies() : null); hashCode = 31 * hashCode + Objects.hashCode(newInstancesProtectedFromScaleIn()); hashCode = 31 * hashCode + Objects.hashCode(serviceLinkedRoleARN()); hashCode = 31 * hashCode + Objects.hashCode(maxInstanceLifetime()); hashCode = 31 * hashCode + Objects.hashCode(capacityRebalance()); hashCode = 31 * hashCode + Objects.hashCode(context()); hashCode = 31 * hashCode + Objects.hashCode(desiredCapacityType()); hashCode = 31 * hashCode + Objects.hashCode(defaultInstanceWarmup()); hashCode = 31 * hashCode + Objects.hashCode(instanceMaintenancePolicy()); hashCode = 31 * hashCode + Objects.hashCode(availabilityZoneDistribution()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof UpdateAutoScalingGroupRequest)) { return false; } UpdateAutoScalingGroupRequest other = (UpdateAutoScalingGroupRequest) obj; return Objects.equals(autoScalingGroupName(), other.autoScalingGroupName()) && Objects.equals(launchConfigurationName(), other.launchConfigurationName()) && Objects.equals(launchTemplate(), other.launchTemplate()) && Objects.equals(mixedInstancesPolicy(), other.mixedInstancesPolicy()) && Objects.equals(minSize(), other.minSize()) && Objects.equals(maxSize(), other.maxSize()) && Objects.equals(desiredCapacity(), other.desiredCapacity()) && Objects.equals(defaultCooldown(), other.defaultCooldown()) && hasAvailabilityZones() == other.hasAvailabilityZones() && Objects.equals(availabilityZones(), other.availabilityZones()) && Objects.equals(healthCheckType(), other.healthCheckType()) && Objects.equals(healthCheckGracePeriod(), other.healthCheckGracePeriod()) && Objects.equals(placementGroup(), other.placementGroup()) && Objects.equals(vpcZoneIdentifier(), other.vpcZoneIdentifier()) && hasTerminationPolicies() == other.hasTerminationPolicies() && Objects.equals(terminationPolicies(), other.terminationPolicies()) && Objects.equals(newInstancesProtectedFromScaleIn(), other.newInstancesProtectedFromScaleIn()) && Objects.equals(serviceLinkedRoleARN(), other.serviceLinkedRoleARN()) && Objects.equals(maxInstanceLifetime(), other.maxInstanceLifetime()) && Objects.equals(capacityRebalance(), other.capacityRebalance()) && Objects.equals(context(), other.context()) && Objects.equals(desiredCapacityType(), other.desiredCapacityType()) && Objects.equals(defaultInstanceWarmup(), other.defaultInstanceWarmup()) && Objects.equals(instanceMaintenancePolicy(), other.instanceMaintenancePolicy()) && Objects.equals(availabilityZoneDistribution(), other.availabilityZoneDistribution()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("UpdateAutoScalingGroupRequest").add("AutoScalingGroupName", autoScalingGroupName()) .add("LaunchConfigurationName", launchConfigurationName()).add("LaunchTemplate", launchTemplate()) .add("MixedInstancesPolicy", mixedInstancesPolicy()).add("MinSize", minSize()).add("MaxSize", maxSize()) .add("DesiredCapacity", desiredCapacity()).add("DefaultCooldown", defaultCooldown()) .add("AvailabilityZones", hasAvailabilityZones() ? availabilityZones() : null) .add("HealthCheckType", healthCheckType()).add("HealthCheckGracePeriod", healthCheckGracePeriod()) .add("PlacementGroup", placementGroup()).add("VPCZoneIdentifier", vpcZoneIdentifier()) .add("TerminationPolicies", hasTerminationPolicies() ? terminationPolicies() : null) .add("NewInstancesProtectedFromScaleIn", newInstancesProtectedFromScaleIn()) .add("ServiceLinkedRoleARN", serviceLinkedRoleARN()).add("MaxInstanceLifetime", maxInstanceLifetime()) .add("CapacityRebalance", capacityRebalance()).add("Context", context()) .add("DesiredCapacityType", desiredCapacityType()).add("DefaultInstanceWarmup", defaultInstanceWarmup()) .add("InstanceMaintenancePolicy", instanceMaintenancePolicy()) .add("AvailabilityZoneDistribution", availabilityZoneDistribution()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "AutoScalingGroupName": return Optional.ofNullable(clazz.cast(autoScalingGroupName())); case "LaunchConfigurationName": return Optional.ofNullable(clazz.cast(launchConfigurationName())); case "LaunchTemplate": return Optional.ofNullable(clazz.cast(launchTemplate())); case "MixedInstancesPolicy": return Optional.ofNullable(clazz.cast(mixedInstancesPolicy())); case "MinSize": return Optional.ofNullable(clazz.cast(minSize())); case "MaxSize": return Optional.ofNullable(clazz.cast(maxSize())); case "DesiredCapacity": return Optional.ofNullable(clazz.cast(desiredCapacity())); case "DefaultCooldown": return Optional.ofNullable(clazz.cast(defaultCooldown())); case "AvailabilityZones": return Optional.ofNullable(clazz.cast(availabilityZones())); case "HealthCheckType": return Optional.ofNullable(clazz.cast(healthCheckType())); case "HealthCheckGracePeriod": return Optional.ofNullable(clazz.cast(healthCheckGracePeriod())); case "PlacementGroup": return Optional.ofNullable(clazz.cast(placementGroup())); case "VPCZoneIdentifier": return Optional.ofNullable(clazz.cast(vpcZoneIdentifier())); case "TerminationPolicies": return Optional.ofNullable(clazz.cast(terminationPolicies())); case "NewInstancesProtectedFromScaleIn": return Optional.ofNullable(clazz.cast(newInstancesProtectedFromScaleIn())); case "ServiceLinkedRoleARN": return Optional.ofNullable(clazz.cast(serviceLinkedRoleARN())); case "MaxInstanceLifetime": return Optional.ofNullable(clazz.cast(maxInstanceLifetime())); case "CapacityRebalance": return Optional.ofNullable(clazz.cast(capacityRebalance())); case "Context": return Optional.ofNullable(clazz.cast(context())); case "DesiredCapacityType": return Optional.ofNullable(clazz.cast(desiredCapacityType())); case "DefaultInstanceWarmup": return Optional.ofNullable(clazz.cast(defaultInstanceWarmup())); case "InstanceMaintenancePolicy": return Optional.ofNullable(clazz.cast(instanceMaintenancePolicy())); case "AvailabilityZoneDistribution": return Optional.ofNullable(clazz.cast(availabilityZoneDistribution())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((UpdateAutoScalingGroupRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends AutoScalingRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the Auto Scaling group. *

* * @param autoScalingGroupName * The name of the Auto Scaling group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder autoScalingGroupName(String autoScalingGroupName); /** *

* The name of the launch configuration. If you specify LaunchConfigurationName in your update * request, you can't specify LaunchTemplate or MixedInstancesPolicy. *

* * @param launchConfigurationName * The name of the launch configuration. If you specify LaunchConfigurationName in your * update request, you can't specify LaunchTemplate or MixedInstancesPolicy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder launchConfigurationName(String launchConfigurationName); /** *

* The launch template and version to use to specify the updates. If you specify LaunchTemplate in * your update request, you can't specify LaunchConfigurationName or * MixedInstancesPolicy. *

* * @param launchTemplate * The launch template and version to use to specify the updates. If you specify * LaunchTemplate in your update request, you can't specify * LaunchConfigurationName or MixedInstancesPolicy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder launchTemplate(LaunchTemplateSpecification launchTemplate); /** *

* The launch template and version to use to specify the updates. If you specify LaunchTemplate in * your update request, you can't specify LaunchConfigurationName or * MixedInstancesPolicy. *

* This is a convenience method that creates an instance of the {@link LaunchTemplateSpecification.Builder} * avoiding the need to create one manually via {@link LaunchTemplateSpecification#builder()}. * *

* When the {@link Consumer} completes, {@link LaunchTemplateSpecification.Builder#build()} is called * immediately and its result is passed to {@link #launchTemplate(LaunchTemplateSpecification)}. * * @param launchTemplate * a consumer that will call methods on {@link LaunchTemplateSpecification.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #launchTemplate(LaunchTemplateSpecification) */ default Builder launchTemplate(Consumer launchTemplate) { return launchTemplate(LaunchTemplateSpecification.builder().applyMutation(launchTemplate).build()); } /** *

* The mixed instances policy. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling * User Guide. *

* * @param mixedInstancesPolicy * The mixed instances policy. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto * Scaling User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder mixedInstancesPolicy(MixedInstancesPolicy mixedInstancesPolicy); /** *

* The mixed instances policy. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling * User Guide. *

* This is a convenience method that creates an instance of the {@link MixedInstancesPolicy.Builder} avoiding * the need to create one manually via {@link MixedInstancesPolicy#builder()}. * *

* When the {@link Consumer} completes, {@link MixedInstancesPolicy.Builder#build()} is called immediately and * its result is passed to {@link #mixedInstancesPolicy(MixedInstancesPolicy)}. * * @param mixedInstancesPolicy * a consumer that will call methods on {@link MixedInstancesPolicy.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #mixedInstancesPolicy(MixedInstancesPolicy) */ default Builder mixedInstancesPolicy(Consumer mixedInstancesPolicy) { return mixedInstancesPolicy(MixedInstancesPolicy.builder().applyMutation(mixedInstancesPolicy).build()); } /** *

* The minimum size of the Auto Scaling group. *

* * @param minSize * The minimum size of the Auto Scaling group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder minSize(Integer minSize); /** *

* The maximum size of the Auto Scaling group. *

* *

* With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above * MaxSize to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go * above MaxSize by more than your largest instance weight (weights that define how many units each * instance contributes to the desired capacity of the group). *

*
* * @param maxSize * The maximum size of the Auto Scaling group.

*

* With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go * above MaxSize to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling * will never go above MaxSize by more than your largest instance weight (weights that * define how many units each instance contributes to the desired capacity of the group). *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder maxSize(Integer maxSize); /** *

* The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the * capacity it attempts to maintain. This number must be greater than or equal to the minimum size of the group * and less than or equal to the maximum size of the group. *

* * @param desiredCapacity * The desired capacity is the initial capacity of the Auto Scaling group after this operation completes * and the capacity it attempts to maintain. This number must be greater than or equal to the minimum * size of the group and less than or equal to the maximum size of the group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder desiredCapacity(Integer desiredCapacity); /** *

* Only needed if you use simple scaling policies. *

*

* The amount of time, in seconds, between one scaling activity ending and another one starting due to simple * scaling policies. For more information, see Scaling * cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. *

* * @param defaultCooldown * Only needed if you use simple scaling policies.

*

* The amount of time, in seconds, between one scaling activity ending and another one starting due to * simple scaling policies. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder defaultCooldown(Integer defaultCooldown); /** *

* One or more Availability Zones for the group. *

* * @param availabilityZones * One or more Availability Zones for the group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder availabilityZones(Collection availabilityZones); /** *

* One or more Availability Zones for the group. *

* * @param availabilityZones * One or more Availability Zones for the group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder availabilityZones(String... availabilityZones); /** *

* A comma-separated value string of one or more health check types. *

*

* The valid values are EC2, EBS, ELB, and VPC_LATTICE. * EC2 is the default health check and cannot be disabled. For more information, see Health * checks for instances in an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. *

*

* Only specify EC2 if you must clear a value that was previously set. *

* * @param healthCheckType * A comma-separated value string of one or more health check types.

*

* The valid values are EC2, EBS, ELB, and * VPC_LATTICE. EC2 is the default health check and cannot be disabled. For * more information, see Health checks for instances in an Auto Scaling group in the Amazon EC2 Auto Scaling User * Guide. *

*

* Only specify EC2 if you must clear a value that was previously set. * @return Returns a reference to this object so that method calls can be chained together. */ Builder healthCheckType(String healthCheckType); /** *

* The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an * EC2 instance that has come into service and marking it unhealthy due to a failed health check. This is useful * if your instances do not immediately pass their health checks after they enter the InService * state. For more information, see Set the health * check grace period for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. *

* * @param healthCheckGracePeriod * The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status * of an EC2 instance that has come into service and marking it unhealthy due to a failed health check. * This is useful if your instances do not immediately pass their health checks after they enter the * InService state. For more information, see Set the * health check grace period for an Auto Scaling group in the Amazon EC2 Auto Scaling User * Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder healthCheckGracePeriod(Integer healthCheckGracePeriod); /** *

* The name of an existing placement group into which to launch your instances. To remove the placement group * setting, pass an empty string for placement-group. For more information about placement groups, * see Placement groups * in the Amazon EC2 User Guide for Linux Instances. *

* *

* A cluster placement group is a logical grouping of instances within a single Availability Zone. You * cannot specify multiple Availability Zones and a cluster placement group. *

*
* * @param placementGroup * The name of an existing placement group into which to launch your instances. To remove the placement * group setting, pass an empty string for placement-group. For more information about * placement groups, see Placement groups * in the Amazon EC2 User Guide for Linux Instances.

*

* A cluster placement group is a logical grouping of instances within a single Availability Zone. * You cannot specify multiple Availability Zones and a cluster placement group. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder placementGroup(String placementGroup); /** *

* A comma-separated list of subnet IDs for a virtual private cloud (VPC). If you specify * VPCZoneIdentifier with AvailabilityZones, the subnets that you specify must reside * in those Availability Zones. *

* * @param vpcZoneIdentifier * A comma-separated list of subnet IDs for a virtual private cloud (VPC). If you specify * VPCZoneIdentifier with AvailabilityZones, the subnets that you specify must * reside in those Availability Zones. * @return Returns a reference to this object so that method calls can be chained together. */ Builder vpcZoneIdentifier(String vpcZoneIdentifier); /** *

* A policy or a list of policies that are used to select the instances to terminate. The policies are executed * in the order that you list them. For more information, see Configure termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User * Guide. *

*

* Valid values: Default | AllocationStrategy | ClosestToNextInstanceHour * | NewestInstance | OldestInstance | OldestLaunchConfiguration | * OldestLaunchTemplate | * arn:aws:lambda:region:account-id:function:my-function:my-alias *

* * @param terminationPolicies * A policy or a list of policies that are used to select the instances to terminate. The policies are * executed in the order that you list them. For more information, see Configure termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User * Guide.

*

* Valid values: Default | AllocationStrategy | * ClosestToNextInstanceHour | NewestInstance | OldestInstance | * OldestLaunchConfiguration | OldestLaunchTemplate | * arn:aws:lambda:region:account-id:function:my-function:my-alias * @return Returns a reference to this object so that method calls can be chained together. */ Builder terminationPolicies(Collection terminationPolicies); /** *

* A policy or a list of policies that are used to select the instances to terminate. The policies are executed * in the order that you list them. For more information, see Configure termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User * Guide. *

*

* Valid values: Default | AllocationStrategy | ClosestToNextInstanceHour * | NewestInstance | OldestInstance | OldestLaunchConfiguration | * OldestLaunchTemplate | * arn:aws:lambda:region:account-id:function:my-function:my-alias *

* * @param terminationPolicies * A policy or a list of policies that are used to select the instances to terminate. The policies are * executed in the order that you list them. For more information, see Configure termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User * Guide.

*

* Valid values: Default | AllocationStrategy | * ClosestToNextInstanceHour | NewestInstance | OldestInstance | * OldestLaunchConfiguration | OldestLaunchTemplate | * arn:aws:lambda:region:account-id:function:my-function:my-alias * @return Returns a reference to this object so that method calls can be chained together. */ Builder terminationPolicies(String... terminationPolicies); /** *

* Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when * scaling in. For more information about preventing instances from terminating on scale in, see Use * instance scale-in protection in the Amazon EC2 Auto Scaling User Guide. *

* * @param newInstancesProtectedFromScaleIn * Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling * when scaling in. For more information about preventing instances from terminating on scale in, see Use * instance scale-in protection in the Amazon EC2 Auto Scaling User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder newInstancesProtectedFromScaleIn(Boolean newInstancesProtectedFromScaleIn); /** *

* The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other * Amazon Web Services on your behalf. For more information, see Service-linked roles in the Amazon EC2 Auto Scaling User Guide. *

* * @param serviceLinkedRoleARN * The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call * other Amazon Web Services on your behalf. For more information, see Service-linked roles in the Amazon EC2 Auto Scaling User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serviceLinkedRoleARN(String serviceLinkedRoleARN); /** *

* The maximum amount of time, in seconds, that an instance can be in service. The default is null. If * specified, the value must be either 0 or a number equal to or greater than 86,400 seconds (1 day). To clear a * previously set value, specify a new value of 0. For more information, see Replacing Auto * Scaling instances based on maximum instance lifetime in the Amazon EC2 Auto Scaling User Guide. *

* * @param maxInstanceLifetime * The maximum amount of time, in seconds, that an instance can be in service. The default is null. If * specified, the value must be either 0 or a number equal to or greater than 86,400 seconds (1 day). To * clear a previously set value, specify a new value of 0. For more information, see Replacing * Auto Scaling instances based on maximum instance lifetime in the Amazon EC2 Auto Scaling User * Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxInstanceLifetime(Integer maxInstanceLifetime); /** *

* Enables or disables Capacity Rebalancing. For more information, see Use * Capacity Rebalancing to handle Amazon EC2 Spot Interruptions in the Amazon EC2 Auto Scaling User * Guide. *

* * @param capacityRebalance * Enables or disables Capacity Rebalancing. For more information, see Use * Capacity Rebalancing to handle Amazon EC2 Spot Interruptions in the Amazon EC2 Auto Scaling * User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder capacityRebalance(Boolean capacityRebalance); /** *

* Reserved. *

* * @param context * Reserved. * @return Returns a reference to this object so that method calls can be chained together. */ Builder context(String context); /** *

* The unit of measurement for the value specified for desired capacity. Amazon EC2 Auto Scaling supports * DesiredCapacityType for attribute-based instance type selection only. For more information, see * Create a mixed instances group using attribute-based instance type selection in the Amazon EC2 Auto * Scaling User Guide. *

*

* By default, Amazon EC2 Auto Scaling specifies units, which translates into number of instances. *

*

* Valid values: units | vcpu | memory-mib *

* * @param desiredCapacityType * The unit of measurement for the value specified for desired capacity. Amazon EC2 Auto Scaling supports * DesiredCapacityType for attribute-based instance type selection only. For more * information, see Create a mixed instances group using attribute-based instance type selection in the Amazon EC2 * Auto Scaling User Guide.

*

* By default, Amazon EC2 Auto Scaling specifies units, which translates into number of * instances. *

*

* Valid values: units | vcpu | memory-mib * @return Returns a reference to this object so that method calls can be chained together. */ Builder desiredCapacityType(String desiredCapacityType); /** *

* The amount of time, in seconds, until a new instance is considered to have finished initializing and resource * consumption to become stable after it enters the InService state. *

*

* During an instance refresh, Amazon EC2 Auto Scaling waits for the warm-up period after it replaces an * instance before it moves on to replacing the next instance. Amazon EC2 Auto Scaling also waits for the * warm-up period before aggregating the metrics for new instances with existing instances in the Amazon * CloudWatch metrics that are used for scaling, resulting in more reliable usage data. For more information, * see Set the default instance warmup for an Auto Scaling group in the Amazon EC2 Auto Scaling User * Guide. *

* *

* To manage various warm-up settings at the group level, we recommend that you set the default instance warmup, * even if it is set to 0 seconds. To remove a value that you previously set, include the property but * specify -1 for the value. However, we strongly recommend keeping the default instance warmup * enabled by specifying a value of 0 or other nominal value. *

*
* * @param defaultInstanceWarmup * The amount of time, in seconds, until a new instance is considered to have finished initializing and * resource consumption to become stable after it enters the InService state.

*

* During an instance refresh, Amazon EC2 Auto Scaling waits for the warm-up period after it replaces an * instance before it moves on to replacing the next instance. Amazon EC2 Auto Scaling also waits for the * warm-up period before aggregating the metrics for new instances with existing instances in the Amazon * CloudWatch metrics that are used for scaling, resulting in more reliable usage data. For more * information, see Set the default instance warmup for an Auto Scaling group in the Amazon EC2 Auto Scaling User * Guide. *

* *

* To manage various warm-up settings at the group level, we recommend that you set the default instance * warmup, even if it is set to 0 seconds. To remove a value that you previously set, include the * property but specify -1 for the value. However, we strongly recommend keeping the default * instance warmup enabled by specifying a value of 0 or other nominal value. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder defaultInstanceWarmup(Integer defaultInstanceWarmup); /** *

* An instance maintenance policy. For more information, see Set * instance maintenance policy in the Amazon EC2 Auto Scaling User Guide. *

* * @param instanceMaintenancePolicy * An instance maintenance policy. For more information, see Set instance maintenance policy in the Amazon EC2 Auto Scaling User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceMaintenancePolicy(InstanceMaintenancePolicy instanceMaintenancePolicy); /** *

* An instance maintenance policy. For more information, see Set * instance maintenance policy in the Amazon EC2 Auto Scaling User Guide. *

* This is a convenience method that creates an instance of the {@link InstanceMaintenancePolicy.Builder} * avoiding the need to create one manually via {@link InstanceMaintenancePolicy#builder()}. * *

* When the {@link Consumer} completes, {@link InstanceMaintenancePolicy.Builder#build()} is called immediately * and its result is passed to {@link #instanceMaintenancePolicy(InstanceMaintenancePolicy)}. * * @param instanceMaintenancePolicy * a consumer that will call methods on {@link InstanceMaintenancePolicy.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #instanceMaintenancePolicy(InstanceMaintenancePolicy) */ default Builder instanceMaintenancePolicy(Consumer instanceMaintenancePolicy) { return instanceMaintenancePolicy(InstanceMaintenancePolicy.builder().applyMutation(instanceMaintenancePolicy).build()); } /** *

* The instance capacity distribution across Availability Zones. *

* * @param availabilityZoneDistribution * The instance capacity distribution across Availability Zones. * @return Returns a reference to this object so that method calls can be chained together. */ Builder availabilityZoneDistribution(AvailabilityZoneDistribution availabilityZoneDistribution); /** *

* The instance capacity distribution across Availability Zones. *

* This is a convenience method that creates an instance of the {@link AvailabilityZoneDistribution.Builder} * avoiding the need to create one manually via {@link AvailabilityZoneDistribution#builder()}. * *

* When the {@link Consumer} completes, {@link AvailabilityZoneDistribution.Builder#build()} is called * immediately and its result is passed to {@link #availabilityZoneDistribution(AvailabilityZoneDistribution)}. * * @param availabilityZoneDistribution * a consumer that will call methods on {@link AvailabilityZoneDistribution.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #availabilityZoneDistribution(AvailabilityZoneDistribution) */ default Builder availabilityZoneDistribution(Consumer availabilityZoneDistribution) { return availabilityZoneDistribution(AvailabilityZoneDistribution.builder() .applyMutation(availabilityZoneDistribution).build()); } @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends AutoScalingRequest.BuilderImpl implements Builder { private String autoScalingGroupName; private String launchConfigurationName; private LaunchTemplateSpecification launchTemplate; private MixedInstancesPolicy mixedInstancesPolicy; private Integer minSize; private Integer maxSize; private Integer desiredCapacity; private Integer defaultCooldown; private List availabilityZones = DefaultSdkAutoConstructList.getInstance(); private String healthCheckType; private Integer healthCheckGracePeriod; private String placementGroup; private String vpcZoneIdentifier; private List terminationPolicies = DefaultSdkAutoConstructList.getInstance(); private Boolean newInstancesProtectedFromScaleIn; private String serviceLinkedRoleARN; private Integer maxInstanceLifetime; private Boolean capacityRebalance; private String context; private String desiredCapacityType; private Integer defaultInstanceWarmup; private InstanceMaintenancePolicy instanceMaintenancePolicy; private AvailabilityZoneDistribution availabilityZoneDistribution; private BuilderImpl() { } private BuilderImpl(UpdateAutoScalingGroupRequest model) { super(model); autoScalingGroupName(model.autoScalingGroupName); launchConfigurationName(model.launchConfigurationName); launchTemplate(model.launchTemplate); mixedInstancesPolicy(model.mixedInstancesPolicy); minSize(model.minSize); maxSize(model.maxSize); desiredCapacity(model.desiredCapacity); defaultCooldown(model.defaultCooldown); availabilityZones(model.availabilityZones); healthCheckType(model.healthCheckType); healthCheckGracePeriod(model.healthCheckGracePeriod); placementGroup(model.placementGroup); vpcZoneIdentifier(model.vpcZoneIdentifier); terminationPolicies(model.terminationPolicies); newInstancesProtectedFromScaleIn(model.newInstancesProtectedFromScaleIn); serviceLinkedRoleARN(model.serviceLinkedRoleARN); maxInstanceLifetime(model.maxInstanceLifetime); capacityRebalance(model.capacityRebalance); context(model.context); desiredCapacityType(model.desiredCapacityType); defaultInstanceWarmup(model.defaultInstanceWarmup); instanceMaintenancePolicy(model.instanceMaintenancePolicy); availabilityZoneDistribution(model.availabilityZoneDistribution); } public final String getAutoScalingGroupName() { return autoScalingGroupName; } public final void setAutoScalingGroupName(String autoScalingGroupName) { this.autoScalingGroupName = autoScalingGroupName; } @Override public final Builder autoScalingGroupName(String autoScalingGroupName) { this.autoScalingGroupName = autoScalingGroupName; return this; } public final String getLaunchConfigurationName() { return launchConfigurationName; } public final void setLaunchConfigurationName(String launchConfigurationName) { this.launchConfigurationName = launchConfigurationName; } @Override public final Builder launchConfigurationName(String launchConfigurationName) { this.launchConfigurationName = launchConfigurationName; return this; } public final LaunchTemplateSpecification.Builder getLaunchTemplate() { return launchTemplate != null ? launchTemplate.toBuilder() : null; } public final void setLaunchTemplate(LaunchTemplateSpecification.BuilderImpl launchTemplate) { this.launchTemplate = launchTemplate != null ? launchTemplate.build() : null; } @Override public final Builder launchTemplate(LaunchTemplateSpecification launchTemplate) { this.launchTemplate = launchTemplate; return this; } public final MixedInstancesPolicy.Builder getMixedInstancesPolicy() { return mixedInstancesPolicy != null ? mixedInstancesPolicy.toBuilder() : null; } public final void setMixedInstancesPolicy(MixedInstancesPolicy.BuilderImpl mixedInstancesPolicy) { this.mixedInstancesPolicy = mixedInstancesPolicy != null ? mixedInstancesPolicy.build() : null; } @Override public final Builder mixedInstancesPolicy(MixedInstancesPolicy mixedInstancesPolicy) { this.mixedInstancesPolicy = mixedInstancesPolicy; return this; } public final Integer getMinSize() { return minSize; } public final void setMinSize(Integer minSize) { this.minSize = minSize; } @Override public final Builder minSize(Integer minSize) { this.minSize = minSize; return this; } public final Integer getMaxSize() { return maxSize; } public final void setMaxSize(Integer maxSize) { this.maxSize = maxSize; } @Override public final Builder maxSize(Integer maxSize) { this.maxSize = maxSize; return this; } public final Integer getDesiredCapacity() { return desiredCapacity; } public final void setDesiredCapacity(Integer desiredCapacity) { this.desiredCapacity = desiredCapacity; } @Override public final Builder desiredCapacity(Integer desiredCapacity) { this.desiredCapacity = desiredCapacity; return this; } public final Integer getDefaultCooldown() { return defaultCooldown; } public final void setDefaultCooldown(Integer defaultCooldown) { this.defaultCooldown = defaultCooldown; } @Override public final Builder defaultCooldown(Integer defaultCooldown) { this.defaultCooldown = defaultCooldown; return this; } public final Collection getAvailabilityZones() { if (availabilityZones instanceof SdkAutoConstructList) { return null; } return availabilityZones; } public final void setAvailabilityZones(Collection availabilityZones) { this.availabilityZones = AvailabilityZonesCopier.copy(availabilityZones); } @Override public final Builder availabilityZones(Collection availabilityZones) { this.availabilityZones = AvailabilityZonesCopier.copy(availabilityZones); return this; } @Override @SafeVarargs public final Builder availabilityZones(String... availabilityZones) { availabilityZones(Arrays.asList(availabilityZones)); return this; } public final String getHealthCheckType() { return healthCheckType; } public final void setHealthCheckType(String healthCheckType) { this.healthCheckType = healthCheckType; } @Override public final Builder healthCheckType(String healthCheckType) { this.healthCheckType = healthCheckType; return this; } public final Integer getHealthCheckGracePeriod() { return healthCheckGracePeriod; } public final void setHealthCheckGracePeriod(Integer healthCheckGracePeriod) { this.healthCheckGracePeriod = healthCheckGracePeriod; } @Override public final Builder healthCheckGracePeriod(Integer healthCheckGracePeriod) { this.healthCheckGracePeriod = healthCheckGracePeriod; return this; } public final String getPlacementGroup() { return placementGroup; } public final void setPlacementGroup(String placementGroup) { this.placementGroup = placementGroup; } @Override public final Builder placementGroup(String placementGroup) { this.placementGroup = placementGroup; return this; } public final String getVpcZoneIdentifier() { return vpcZoneIdentifier; } public final void setVpcZoneIdentifier(String vpcZoneIdentifier) { this.vpcZoneIdentifier = vpcZoneIdentifier; } @Override public final Builder vpcZoneIdentifier(String vpcZoneIdentifier) { this.vpcZoneIdentifier = vpcZoneIdentifier; return this; } public final Collection getTerminationPolicies() { if (terminationPolicies instanceof SdkAutoConstructList) { return null; } return terminationPolicies; } public final void setTerminationPolicies(Collection terminationPolicies) { this.terminationPolicies = TerminationPoliciesCopier.copy(terminationPolicies); } @Override public final Builder terminationPolicies(Collection terminationPolicies) { this.terminationPolicies = TerminationPoliciesCopier.copy(terminationPolicies); return this; } @Override @SafeVarargs public final Builder terminationPolicies(String... terminationPolicies) { terminationPolicies(Arrays.asList(terminationPolicies)); return this; } public final Boolean getNewInstancesProtectedFromScaleIn() { return newInstancesProtectedFromScaleIn; } public final void setNewInstancesProtectedFromScaleIn(Boolean newInstancesProtectedFromScaleIn) { this.newInstancesProtectedFromScaleIn = newInstancesProtectedFromScaleIn; } @Override public final Builder newInstancesProtectedFromScaleIn(Boolean newInstancesProtectedFromScaleIn) { this.newInstancesProtectedFromScaleIn = newInstancesProtectedFromScaleIn; return this; } public final String getServiceLinkedRoleARN() { return serviceLinkedRoleARN; } public final void setServiceLinkedRoleARN(String serviceLinkedRoleARN) { this.serviceLinkedRoleARN = serviceLinkedRoleARN; } @Override public final Builder serviceLinkedRoleARN(String serviceLinkedRoleARN) { this.serviceLinkedRoleARN = serviceLinkedRoleARN; return this; } public final Integer getMaxInstanceLifetime() { return maxInstanceLifetime; } public final void setMaxInstanceLifetime(Integer maxInstanceLifetime) { this.maxInstanceLifetime = maxInstanceLifetime; } @Override public final Builder maxInstanceLifetime(Integer maxInstanceLifetime) { this.maxInstanceLifetime = maxInstanceLifetime; return this; } public final Boolean getCapacityRebalance() { return capacityRebalance; } public final void setCapacityRebalance(Boolean capacityRebalance) { this.capacityRebalance = capacityRebalance; } @Override public final Builder capacityRebalance(Boolean capacityRebalance) { this.capacityRebalance = capacityRebalance; return this; } public final String getContext() { return context; } public final void setContext(String context) { this.context = context; } @Override public final Builder context(String context) { this.context = context; return this; } public final String getDesiredCapacityType() { return desiredCapacityType; } public final void setDesiredCapacityType(String desiredCapacityType) { this.desiredCapacityType = desiredCapacityType; } @Override public final Builder desiredCapacityType(String desiredCapacityType) { this.desiredCapacityType = desiredCapacityType; return this; } public final Integer getDefaultInstanceWarmup() { return defaultInstanceWarmup; } public final void setDefaultInstanceWarmup(Integer defaultInstanceWarmup) { this.defaultInstanceWarmup = defaultInstanceWarmup; } @Override public final Builder defaultInstanceWarmup(Integer defaultInstanceWarmup) { this.defaultInstanceWarmup = defaultInstanceWarmup; return this; } public final InstanceMaintenancePolicy.Builder getInstanceMaintenancePolicy() { return instanceMaintenancePolicy != null ? instanceMaintenancePolicy.toBuilder() : null; } public final void setInstanceMaintenancePolicy(InstanceMaintenancePolicy.BuilderImpl instanceMaintenancePolicy) { this.instanceMaintenancePolicy = instanceMaintenancePolicy != null ? instanceMaintenancePolicy.build() : null; } @Override public final Builder instanceMaintenancePolicy(InstanceMaintenancePolicy instanceMaintenancePolicy) { this.instanceMaintenancePolicy = instanceMaintenancePolicy; return this; } public final AvailabilityZoneDistribution.Builder getAvailabilityZoneDistribution() { return availabilityZoneDistribution != null ? availabilityZoneDistribution.toBuilder() : null; } public final void setAvailabilityZoneDistribution(AvailabilityZoneDistribution.BuilderImpl availabilityZoneDistribution) { this.availabilityZoneDistribution = availabilityZoneDistribution != null ? availabilityZoneDistribution.build() : null; } @Override public final Builder availabilityZoneDistribution(AvailabilityZoneDistribution availabilityZoneDistribution) { this.availabilityZoneDistribution = availabilityZoneDistribution; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public UpdateAutoScalingGroupRequest build() { return new UpdateAutoScalingGroupRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy