software.amazon.awssdk.services.autoscaling.model.UpdateAutoScalingGroupRequest Maven / Gradle / Ivy
Show all versions of autoscaling Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.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 extends Builder> 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