com.aliyun.sdk.service.ess20220222.models.ModifyScalingGroupRequest Maven / Gradle / Ivy
Show all versions of alibabacloud-ess20220222 Show documentation
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.sdk.service.ess20220222.models;
import darabonba.core.RequestModel;
import darabonba.core.TeaModel;
import com.aliyun.sdk.gateway.pop.models.*;
/**
* {@link ModifyScalingGroupRequest} extends {@link RequestModel}
*
* ModifyScalingGroupRequest
*/
public class ModifyScalingGroupRequest extends Request {
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("ActiveScalingConfigurationId")
private String activeScalingConfigurationId;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("AllocationStrategy")
private String allocationStrategy;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("AzBalance")
private Boolean azBalance;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("CompensateWithOnDemand")
private Boolean compensateWithOnDemand;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("CustomPolicyARN")
private String customPolicyARN;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("DefaultCooldown")
@com.aliyun.core.annotation.Validation(maximum = 86400)
private Integer defaultCooldown;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("DesiredCapacity")
private Integer desiredCapacity;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("DisableDesiredCapacity")
private Boolean disableDesiredCapacity;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("GroupDeletionProtection")
private Boolean groupDeletionProtection;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("HealthCheckType")
private String healthCheckType;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("HealthCheckTypes")
private java.util.List < String > healthCheckTypes;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("LaunchTemplateId")
private String launchTemplateId;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("LaunchTemplateOverrides")
private java.util.List < LaunchTemplateOverrides> launchTemplateOverrides;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("LaunchTemplateVersion")
private String launchTemplateVersion;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("MaxInstanceLifetime")
private Integer maxInstanceLifetime;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("MaxSize")
private Integer maxSize;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("MinSize")
private Integer minSize;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("MultiAZPolicy")
private String multiAZPolicy;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("OnDemandBaseCapacity")
private Integer onDemandBaseCapacity;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("OnDemandPercentageAboveBaseCapacity")
private Integer onDemandPercentageAboveBaseCapacity;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("OwnerAccount")
private String ownerAccount;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("OwnerId")
private Long ownerId;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("RemovalPolicies")
private java.util.List < String > removalPolicies;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("ResourceOwnerAccount")
private String resourceOwnerAccount;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("ResourceOwnerId")
private Long resourceOwnerId;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("ScalingGroupId")
@com.aliyun.core.annotation.Validation(required = true)
private String scalingGroupId;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("ScalingGroupName")
private String scalingGroupName;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("ScalingPolicy")
private String scalingPolicy;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("SpotAllocationStrategy")
private String spotAllocationStrategy;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("SpotInstancePools")
private Integer spotInstancePools;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("SpotInstanceRemedy")
private Boolean spotInstanceRemedy;
@com.aliyun.core.annotation.Query
@com.aliyun.core.annotation.NameInMap("VSwitchIds")
private java.util.List < String > vSwitchIds;
private ModifyScalingGroupRequest(Builder builder) {
super(builder);
this.activeScalingConfigurationId = builder.activeScalingConfigurationId;
this.allocationStrategy = builder.allocationStrategy;
this.azBalance = builder.azBalance;
this.compensateWithOnDemand = builder.compensateWithOnDemand;
this.customPolicyARN = builder.customPolicyARN;
this.defaultCooldown = builder.defaultCooldown;
this.desiredCapacity = builder.desiredCapacity;
this.disableDesiredCapacity = builder.disableDesiredCapacity;
this.groupDeletionProtection = builder.groupDeletionProtection;
this.healthCheckType = builder.healthCheckType;
this.healthCheckTypes = builder.healthCheckTypes;
this.launchTemplateId = builder.launchTemplateId;
this.launchTemplateOverrides = builder.launchTemplateOverrides;
this.launchTemplateVersion = builder.launchTemplateVersion;
this.maxInstanceLifetime = builder.maxInstanceLifetime;
this.maxSize = builder.maxSize;
this.minSize = builder.minSize;
this.multiAZPolicy = builder.multiAZPolicy;
this.onDemandBaseCapacity = builder.onDemandBaseCapacity;
this.onDemandPercentageAboveBaseCapacity = builder.onDemandPercentageAboveBaseCapacity;
this.ownerAccount = builder.ownerAccount;
this.ownerId = builder.ownerId;
this.removalPolicies = builder.removalPolicies;
this.resourceOwnerAccount = builder.resourceOwnerAccount;
this.resourceOwnerId = builder.resourceOwnerId;
this.scalingGroupId = builder.scalingGroupId;
this.scalingGroupName = builder.scalingGroupName;
this.scalingPolicy = builder.scalingPolicy;
this.spotAllocationStrategy = builder.spotAllocationStrategy;
this.spotInstancePools = builder.spotInstancePools;
this.spotInstanceRemedy = builder.spotInstanceRemedy;
this.vSwitchIds = builder.vSwitchIds;
}
public static Builder builder() {
return new Builder();
}
public static ModifyScalingGroupRequest create() {
return builder().build();
}
@Override
public Builder toBuilder() {
return new Builder(this);
}
/**
* @return activeScalingConfigurationId
*/
public String getActiveScalingConfigurationId() {
return this.activeScalingConfigurationId;
}
/**
* @return allocationStrategy
*/
public String getAllocationStrategy() {
return this.allocationStrategy;
}
/**
* @return azBalance
*/
public Boolean getAzBalance() {
return this.azBalance;
}
/**
* @return compensateWithOnDemand
*/
public Boolean getCompensateWithOnDemand() {
return this.compensateWithOnDemand;
}
/**
* @return customPolicyARN
*/
public String getCustomPolicyARN() {
return this.customPolicyARN;
}
/**
* @return defaultCooldown
*/
public Integer getDefaultCooldown() {
return this.defaultCooldown;
}
/**
* @return desiredCapacity
*/
public Integer getDesiredCapacity() {
return this.desiredCapacity;
}
/**
* @return disableDesiredCapacity
*/
public Boolean getDisableDesiredCapacity() {
return this.disableDesiredCapacity;
}
/**
* @return groupDeletionProtection
*/
public Boolean getGroupDeletionProtection() {
return this.groupDeletionProtection;
}
/**
* @return healthCheckType
*/
public String getHealthCheckType() {
return this.healthCheckType;
}
/**
* @return healthCheckTypes
*/
public java.util.List < String > getHealthCheckTypes() {
return this.healthCheckTypes;
}
/**
* @return launchTemplateId
*/
public String getLaunchTemplateId() {
return this.launchTemplateId;
}
/**
* @return launchTemplateOverrides
*/
public java.util.List < LaunchTemplateOverrides> getLaunchTemplateOverrides() {
return this.launchTemplateOverrides;
}
/**
* @return launchTemplateVersion
*/
public String getLaunchTemplateVersion() {
return this.launchTemplateVersion;
}
/**
* @return maxInstanceLifetime
*/
public Integer getMaxInstanceLifetime() {
return this.maxInstanceLifetime;
}
/**
* @return maxSize
*/
public Integer getMaxSize() {
return this.maxSize;
}
/**
* @return minSize
*/
public Integer getMinSize() {
return this.minSize;
}
/**
* @return multiAZPolicy
*/
public String getMultiAZPolicy() {
return this.multiAZPolicy;
}
/**
* @return onDemandBaseCapacity
*/
public Integer getOnDemandBaseCapacity() {
return this.onDemandBaseCapacity;
}
/**
* @return onDemandPercentageAboveBaseCapacity
*/
public Integer getOnDemandPercentageAboveBaseCapacity() {
return this.onDemandPercentageAboveBaseCapacity;
}
/**
* @return ownerAccount
*/
public String getOwnerAccount() {
return this.ownerAccount;
}
/**
* @return ownerId
*/
public Long getOwnerId() {
return this.ownerId;
}
/**
* @return removalPolicies
*/
public java.util.List < String > getRemovalPolicies() {
return this.removalPolicies;
}
/**
* @return resourceOwnerAccount
*/
public String getResourceOwnerAccount() {
return this.resourceOwnerAccount;
}
/**
* @return resourceOwnerId
*/
public Long getResourceOwnerId() {
return this.resourceOwnerId;
}
/**
* @return scalingGroupId
*/
public String getScalingGroupId() {
return this.scalingGroupId;
}
/**
* @return scalingGroupName
*/
public String getScalingGroupName() {
return this.scalingGroupName;
}
/**
* @return scalingPolicy
*/
public String getScalingPolicy() {
return this.scalingPolicy;
}
/**
* @return spotAllocationStrategy
*/
public String getSpotAllocationStrategy() {
return this.spotAllocationStrategy;
}
/**
* @return spotInstancePools
*/
public Integer getSpotInstancePools() {
return this.spotInstancePools;
}
/**
* @return spotInstanceRemedy
*/
public Boolean getSpotInstanceRemedy() {
return this.spotInstanceRemedy;
}
/**
* @return vSwitchIds
*/
public java.util.List < String > getVSwitchIds() {
return this.vSwitchIds;
}
public static final class Builder extends Request.Builder {
private String activeScalingConfigurationId;
private String allocationStrategy;
private Boolean azBalance;
private Boolean compensateWithOnDemand;
private String customPolicyARN;
private Integer defaultCooldown;
private Integer desiredCapacity;
private Boolean disableDesiredCapacity;
private Boolean groupDeletionProtection;
private String healthCheckType;
private java.util.List < String > healthCheckTypes;
private String launchTemplateId;
private java.util.List < LaunchTemplateOverrides> launchTemplateOverrides;
private String launchTemplateVersion;
private Integer maxInstanceLifetime;
private Integer maxSize;
private Integer minSize;
private String multiAZPolicy;
private Integer onDemandBaseCapacity;
private Integer onDemandPercentageAboveBaseCapacity;
private String ownerAccount;
private Long ownerId;
private java.util.List < String > removalPolicies;
private String resourceOwnerAccount;
private Long resourceOwnerId;
private String scalingGroupId;
private String scalingGroupName;
private String scalingPolicy;
private String spotAllocationStrategy;
private Integer spotInstancePools;
private Boolean spotInstanceRemedy;
private java.util.List < String > vSwitchIds;
private Builder() {
super();
}
private Builder(ModifyScalingGroupRequest request) {
super(request);
this.activeScalingConfigurationId = request.activeScalingConfigurationId;
this.allocationStrategy = request.allocationStrategy;
this.azBalance = request.azBalance;
this.compensateWithOnDemand = request.compensateWithOnDemand;
this.customPolicyARN = request.customPolicyARN;
this.defaultCooldown = request.defaultCooldown;
this.desiredCapacity = request.desiredCapacity;
this.disableDesiredCapacity = request.disableDesiredCapacity;
this.groupDeletionProtection = request.groupDeletionProtection;
this.healthCheckType = request.healthCheckType;
this.healthCheckTypes = request.healthCheckTypes;
this.launchTemplateId = request.launchTemplateId;
this.launchTemplateOverrides = request.launchTemplateOverrides;
this.launchTemplateVersion = request.launchTemplateVersion;
this.maxInstanceLifetime = request.maxInstanceLifetime;
this.maxSize = request.maxSize;
this.minSize = request.minSize;
this.multiAZPolicy = request.multiAZPolicy;
this.onDemandBaseCapacity = request.onDemandBaseCapacity;
this.onDemandPercentageAboveBaseCapacity = request.onDemandPercentageAboveBaseCapacity;
this.ownerAccount = request.ownerAccount;
this.ownerId = request.ownerId;
this.removalPolicies = request.removalPolicies;
this.resourceOwnerAccount = request.resourceOwnerAccount;
this.resourceOwnerId = request.resourceOwnerId;
this.scalingGroupId = request.scalingGroupId;
this.scalingGroupName = request.scalingGroupName;
this.scalingPolicy = request.scalingPolicy;
this.spotAllocationStrategy = request.spotAllocationStrategy;
this.spotInstancePools = request.spotInstancePools;
this.spotInstanceRemedy = request.spotInstanceRemedy;
this.vSwitchIds = request.vSwitchIds;
}
/**
* The ID of the active scaling configuration in the scaling group.
*/
public Builder activeScalingConfigurationId(String activeScalingConfigurationId) {
this.putQueryParameter("ActiveScalingConfigurationId", activeScalingConfigurationId);
this.activeScalingConfigurationId = activeScalingConfigurationId;
return this;
}
/**
* The allocation policy. Auto Scaling selects instance types based on the allocation policy to create the required number of instances. The policy can be applied to pay-as-you-go instances and preemptible instances at the same time. This parameter takes effect only when you set the MultiAZPolicy parameter to COMPOSABLE. Valid values:
*
*
* * priority: Auto Scaling selects instance types based on the specified order to create the required number of instances.
* * lowestPrice: Auto Scaling selects instance types that have the lowest unit price of vCPUs to create the required number of instances.
*
* Default value: priority.
*/
public Builder allocationStrategy(String allocationStrategy) {
this.putQueryParameter("AllocationStrategy", allocationStrategy);
this.allocationStrategy = allocationStrategy;
return this;
}
/**
* Specifies whether to evenly distribute instances in the scaling group across zones. This parameter takes effect only when you set the `MultiAZPolicy` parameter to `COMPOSABLE`. Valid values:
*
*
* * true
* * false
*
* Default value: false.
*/
public Builder azBalance(Boolean azBalance) {
this.putQueryParameter("AzBalance", azBalance);
this.azBalance = azBalance;
return this;
}
/**
* Specifies whether to automatically create pay-as-you-go instances to meet the requirements on the number of ECS instances in the scaling group when the number of preemptible instances cannot be reached due to reasons such as cost-related issues and insufficient resources. This parameter takes effect only if you set `MultiAZPolicy` in the `CreateScalingGroup` operation to `COST_OPTIMIZED`. Valid values:
*
*
* * true
* * false
*/
public Builder compensateWithOnDemand(Boolean compensateWithOnDemand) {
this.putQueryParameter("CompensateWithOnDemand", compensateWithOnDemand);
this.compensateWithOnDemand = compensateWithOnDemand;
return this;
}
/**
* The ARN of the custom scaling policy (Function). This parameter takes effect only when you specify CustomPolicy as the first step of the instance removal policy.
*/
public Builder customPolicyARN(String customPolicyARN) {
this.putQueryParameter("CustomPolicyARN", customPolicyARN);
this.customPolicyARN = customPolicyARN;
return this;
}
/**
* The cooldown period of the scaling group. This parameter is available only if you set ScalingRuleType to SimpleScalingRule. Valid values: 0 to 86400. Unit: seconds.
*
*
* During the cooldown period, Auto Scaling does not execute scaling activities that are triggered by CloudMonitor event-triggered tasks.
*/
public Builder defaultCooldown(Integer defaultCooldown) {
this.putQueryParameter("DefaultCooldown", defaultCooldown);
this.defaultCooldown = defaultCooldown;
return this;
}
/**
* The expected number of ECS instances or elastic container instances in the scaling group. Auto Scaling maintains the expected number of ECS instances or elastic container instances in the scaling group. Make sure that you adhere to the following rule when specifying this parameter: Value of MaxSize ≥ Value of DesiredCapacity ≥ Value of MinSize
*
*
* > If you re-enable the Expected Number of Instances feature, you must specify a value for `DesiredCapacity` again.
*/
public Builder desiredCapacity(Integer desiredCapacity) {
this.putQueryParameter("DesiredCapacity", desiredCapacity);
this.desiredCapacity = desiredCapacity;
return this;
}
/**
* DisableDesiredCapacity.
*/
public Builder disableDesiredCapacity(Boolean disableDesiredCapacity) {
this.putQueryParameter("DisableDesiredCapacity", disableDesiredCapacity);
this.disableDesiredCapacity = disableDesiredCapacity;
return this;
}
/**
* Specifies whether to enable deletion protection for the scaling group. Valid values:
*
*
* * true: enables deletion protection for the scaling group. This way, the scaling group cannot be deleted.
* * false: disables deletion protection for the scaling group.
*/
public Builder groupDeletionProtection(Boolean groupDeletionProtection) {
this.putQueryParameter("GroupDeletionProtection", groupDeletionProtection);
this.groupDeletionProtection = groupDeletionProtection;
return this;
}
/**
* The health check mode of the scaling group. Valid values:
*
*
* * NONE: Auto Scaling does not perform health checks.
* * ECS: Auto Scaling checks the health status of ECS instances in the scaling group.
* * ECI: Auto Scaling checks the health status of elastic container instances in the scaling group.
* * LOAD_BALANCER: Auto Scaling checks the health status of instances in the scaling group based on the health check results of load balancers. The health check results of Classic Load Balancer (CLB) instances are not supported as the health check basis for instances in the scaling group.
*
* > HealthCheckType has the same effect as `HealthCheckTypes`. You can select one of them to specify based on your business requirements. If you specify `HealthCheckTypes`, `HealthCheckType` is ignored. HealthCheckType is optional.
*/
public Builder healthCheckType(String healthCheckType) {
this.putQueryParameter("HealthCheckType", healthCheckType);
this.healthCheckType = healthCheckType;
return this;
}
/**
* The health check modes of the scaling group. Valid values:
*
*
* * NONE: Auto Scaling does not perform health checks.
* * ECS: Auto Scaling checks the health status of ECS instances in the scaling group.
* * ECI: Auto Scaling checks the health status of elastic container instances in the scaling group.
* * LOAD_BALANCER: Auto Scaling checks the health status of instances in the scaling group based on the health check results of load balancers. The health check results of CLB instances are not supported as the health check basis for instances in the scaling group.
*/
public Builder healthCheckTypes(java.util.List < String > healthCheckTypes) {
this.putQueryParameter("HealthCheckTypes", healthCheckTypes);
this.healthCheckTypes = healthCheckTypes;
return this;
}
/**
* The ID of the launch template that is used by Auto Scaling to create instances.
*/
public Builder launchTemplateId(String launchTemplateId) {
this.putQueryParameter("LaunchTemplateId", launchTemplateId);
this.launchTemplateId = launchTemplateId;
return this;
}
/**
* Details of the instance types that are specified in the extended configurations of the launch template.
*/
public Builder launchTemplateOverrides(java.util.List < LaunchTemplateOverrides> launchTemplateOverrides) {
this.putQueryParameter("LaunchTemplateOverrides", launchTemplateOverrides);
this.launchTemplateOverrides = launchTemplateOverrides;
return this;
}
/**
* The version number of the launch template. Valid values:
*
*
* * A fixed template version number.
* * Default: The default template version is always used.
* * Latest: The latest template version is always used.
*/
public Builder launchTemplateVersion(String launchTemplateVersion) {
this.putQueryParameter("LaunchTemplateVersion", launchTemplateVersion);
this.launchTemplateVersion = launchTemplateVersion;
return this;
}
/**
* The maximum life span of the instance in the scaling group. Unit: seconds.
*
*
* Valid values: 86400 to Integer.maxValue. ``You can also set this parameter to 0. A value of 0 indicates that the instance has an unlimited life span in the scaling group.
*
* Default value: null.
*
* > You cannot specify this parameter for scaling groups that manage elastic container instances or scaling groups whose ScalingPolicy is set to recycle.
*/
public Builder maxInstanceLifetime(Integer maxInstanceLifetime) {
this.putQueryParameter("MaxInstanceLifetime", maxInstanceLifetime);
this.maxInstanceLifetime = maxInstanceLifetime;
return this;
}
/**
* The maximum number of ECS instances or elastic container instances that can be contained in the scaling group. If the total number of instances in the scaling group is greater than the value of MaxSize, Auto Scaling proactively removes the surplus instances from the scaling group to restore the total number to match the maximum limit.
*
*
* The value range of MaxSize is directly correlated with the degree of dependency your business has on Auto Scaling. You can go to [Quota Center](https://quotas.console.aliyun.com/products/ess/quotas) to check **the maximum number of instances that a single scaling group can contain.**
*
* For example, if a scaling group can contain up to **2,000** instances, the value range of MaxSize is 0 to 2000.
*/
public Builder maxSize(Integer maxSize) {
this.putQueryParameter("MaxSize", maxSize);
this.maxSize = maxSize;
return this;
}
/**
* The minimum number of ECS instances or elastic container instances that must be contained in the scaling group. If the total number of instances in the scaling group is less than the value of MinSize, Auto Scaling proactively adds instances to the scaling group to ensure that the total number aligns with the minimum threshold.
*
*
* > The value of MinSize must be less than or equal to the value of MaxSize.
*/
public Builder minSize(Integer minSize) {
this.putQueryParameter("MinSize", minSize);
this.minSize = minSize;
return this;
}
/**
* The scaling policy for the multi-zone scaling group that contains ECS instances. Valid values:
*
*
* * PRIORITY: ECS instances are scaled based on the vSwitch priority. The first vSwitch specified by using the VSwitchIds parameter has the highest priority. Auto Scaling preferentially scales instances in the zone where the vSwitch that has the highest priority resides. If the scaling fails, Auto Scaling scales instances in the zone where the vSwitch that has the next highest priority resides.
* * COST_OPTIMIZED: During a scale-out activity, Auto Scaling preferentially creates ECS instances of the instance type that has the lowest unit price of vCPU. During a scale-in activity, Auto Scaling preferentially removes ECS instances of the instance types that have the highest unit price of vCPU. Auto Scaling preferentially creates preemptible instances when preemptible instance types are specified in the scaling configuration. You can use the `CompensateWithOnDemand` parameter to specify whether to automatically create pay-as-you-go instances when Auto Scaling fails to create preemptible instances.
*
* > The `COST_OPTIMIZED` setting takes effect only when multiple instance types are specified or at least one instance type is specified for preemptible instances.
*
* * BALANCE: ECS instances are evenly distributed across zones that are specified in the scaling group. If ECS instances are unevenly distributed among zones due to insufficient resources, you can call the RebalanceInstance operation to evenly distribute the instances among the zones.
* * COMPOSABLE: You can flexibly combine the preceding policies based on your business requirements.
*/
public Builder multiAZPolicy(String multiAZPolicy) {
this.putQueryParameter("MultiAZPolicy", multiAZPolicy);
this.multiAZPolicy = multiAZPolicy;
return this;
}
/**
* The minimum number of pay-as-you-go instances that must be included in the scaling group. Valid values: 0 to 1000. If the number of pay-as-you-go instances is less than the value of this parameter, Auto Scaling preferentially creates pay-as-you-go instances.
*
*
* If you set the `MultiAZPolicy` parameter to `COMPOSABLE` Policy, the default value is 0.
*/
public Builder onDemandBaseCapacity(Integer onDemandBaseCapacity) {
this.putQueryParameter("OnDemandBaseCapacity", onDemandBaseCapacity);
this.onDemandBaseCapacity = onDemandBaseCapacity;
return this;
}
/**
* The expected percentage of pay-as-you-go instances in the excess instances when the minimum number of pay-as-you-go instances reaches the requirement. Valid values: 0 to 100.
*
*
* If you set the `MultiAZPolicy` parameter to `COMPOSABLE` Policy, the default value is 100.
*/
public Builder onDemandPercentageAboveBaseCapacity(Integer onDemandPercentageAboveBaseCapacity) {
this.putQueryParameter("OnDemandPercentageAboveBaseCapacity", onDemandPercentageAboveBaseCapacity);
this.onDemandPercentageAboveBaseCapacity = onDemandPercentageAboveBaseCapacity;
return this;
}
/**
* OwnerAccount.
*/
public Builder ownerAccount(String ownerAccount) {
this.putQueryParameter("OwnerAccount", ownerAccount);
this.ownerAccount = ownerAccount;
return this;
}
/**
* OwnerId.
*/
public Builder ownerId(Long ownerId) {
this.putQueryParameter("OwnerId", ownerId);
this.ownerId = ownerId;
return this;
}
/**
* The policy that is used to remove ECS instances from the scaling group. Valid values:
*
*
* * OldestInstance: removes ECS instances that are added at the earliest point in time to the scaling group.
* * NewestInstance: removes ECS instances that are most recently added to the scaling group.
* * OldestScalingConfiguration: removes ECS instances that are created based on the earliest scaling configuration.
*/
public Builder removalPolicies(java.util.List < String > removalPolicies) {
this.putQueryParameter("RemovalPolicies", removalPolicies);
this.removalPolicies = removalPolicies;
return this;
}
/**
* ResourceOwnerAccount.
*/
public Builder resourceOwnerAccount(String resourceOwnerAccount) {
this.putQueryParameter("ResourceOwnerAccount", resourceOwnerAccount);
this.resourceOwnerAccount = resourceOwnerAccount;
return this;
}
/**
* ResourceOwnerId.
*/
public Builder resourceOwnerId(Long resourceOwnerId) {
this.putQueryParameter("ResourceOwnerId", resourceOwnerId);
this.resourceOwnerId = resourceOwnerId;
return this;
}
/**
* The ID of the scaling group that you want to modify.
*/
public Builder scalingGroupId(String scalingGroupId) {
this.putQueryParameter("ScalingGroupId", scalingGroupId);
this.scalingGroupId = scalingGroupId;
return this;
}
/**
* The name of the scaling group. The name of each scaling group must be unique in a region. The name must be 2 to 64 characters in length and can contain letters, digits, underscores (\_), hyphens (-), and periods (.). The name must start with a letter or a digit.
*/
public Builder scalingGroupName(String scalingGroupName) {
this.putQueryParameter("ScalingGroupName", scalingGroupName);
this.scalingGroupName = scalingGroupName;
return this;
}
/**
* The reclaim mode of the scaling group. Valid values:
*
*
* * recycle: economical mode
*
* * release: release mode
*
* * forcerelease: forced release mode
*
* **
*
* **Note** If you set the value to `forcerelease`, Auto Scaling forcibly releases instances that are in the `Running` state during scale-ins. Forced release is equivalent to power outage. If an instance is forcibly released, ephemeral data on the instance will be cleared and cannot be recovered. Exercise caution when you select this option.
*
* * forcerecycle: forced recycle mode
*
* **
*
* **Note** If you set the value to `forcerecycle`, Auto Scaling forcibly shuts down instances that are in the `Running` state during scale-ins. Forced shutdown is equivalent to power outage. If an instance is forcibly shut down, ephemeral data on the instance will be cleared and cannot be recovered. Exercise caution when you select this option.
*
* ScalingPolicy specifies only the reclaim mode of the scaling group. RemovePolicy of the RemoveInstances operation specifies the manner how instances are removed from the scaling group. For more information, see [RemoveInstances](~~25955~~).
*/
public Builder scalingPolicy(String scalingPolicy) {
this.putQueryParameter("ScalingPolicy", scalingPolicy);
this.scalingPolicy = scalingPolicy;
return this;
}
/**
* The allocation policy of preemptible instances. You can use this parameter to individually specify the allocation policy of preemptible instances. This parameter takes effect only when you set the `MultiAZPolicy` parameter to `COMPOSABLE`. Valid values:
*
*
* * priority: Auto Scaling selects instance types based on the specified order to create the required number of preemptible instances.
* * lowestPrice: Auto Scaling selects instance types that have the lowest unit price of vCPUs to create the required number of preemptible instances.
*
* Default value: priority.
*/
public Builder spotAllocationStrategy(String spotAllocationStrategy) {
this.putQueryParameter("SpotAllocationStrategy", spotAllocationStrategy);
this.spotAllocationStrategy = spotAllocationStrategy;
return this;
}
/**
* The number of instance types that you specify. Auto Scaling creates preemptible instances of multiple instance types that are provided at the lowest price. Valid values: 0 to 10.
*
*
* If you set the `MultiAZPolicy` parameter to `COMPOSABLE` Policy, the default value is 2.
*/
public Builder spotInstancePools(Integer spotInstancePools) {
this.putQueryParameter("SpotInstancePools", spotInstancePools);
this.spotInstancePools = spotInstancePools;
return this;
}
/**
* Specifies whether to supplement preemptible instances. If this parameter is set to true, Auto Scaling creates an instance to replace a preemptible instance when Auto Scaling receives the system message that the preemptible instance is to be reclaimed.
*/
public Builder spotInstanceRemedy(Boolean spotInstanceRemedy) {
this.putQueryParameter("SpotInstanceRemedy", spotInstanceRemedy);
this.spotInstanceRemedy = spotInstanceRemedy;
return this;
}
/**
* The IDs of vSwitches.
*
*
* This parameter takes effect only when the network type of the scaling group is virtual private cloud (VPC). The specified vSwitches and the scaling group must reside in the same VPC.
*
* The vSwitches can reside in different zones. The vSwitches are sorted in ascending order. The first vSwitch specified by using the VSwitchIds parameter has the highest priority. If Auto Scaling fails to create ECS instances in the zone where the vSwitch that has the highest priority resides, Auto Scaling creates ECS instances in the zone where the vSwitch that has the next highest priority resides.
*/
public Builder vSwitchIds(java.util.List < String > vSwitchIds) {
this.putQueryParameter("VSwitchIds", vSwitchIds);
this.vSwitchIds = vSwitchIds;
return this;
}
@Override
public ModifyScalingGroupRequest build() {
return new ModifyScalingGroupRequest(this);
}
}
public static class LaunchTemplateOverrides extends TeaModel {
@com.aliyun.core.annotation.NameInMap("InstanceType")
private String instanceType;
@com.aliyun.core.annotation.NameInMap("SpotPriceLimit")
private Float spotPriceLimit;
@com.aliyun.core.annotation.NameInMap("WeightedCapacity")
private Integer weightedCapacity;
private LaunchTemplateOverrides(Builder builder) {
this.instanceType = builder.instanceType;
this.spotPriceLimit = builder.spotPriceLimit;
this.weightedCapacity = builder.weightedCapacity;
}
public static Builder builder() {
return new Builder();
}
public static LaunchTemplateOverrides create() {
return builder().build();
}
/**
* @return instanceType
*/
public String getInstanceType() {
return this.instanceType;
}
/**
* @return spotPriceLimit
*/
public Float getSpotPriceLimit() {
return this.spotPriceLimit;
}
/**
* @return weightedCapacity
*/
public Integer getWeightedCapacity() {
return this.weightedCapacity;
}
public static final class Builder {
private String instanceType;
private Float spotPriceLimit;
private Integer weightedCapacity;
/**
* The instance type. The instance type that you specify by using the InstanceType parameter overwrites the instance type that is specified in the launch template.
*
*
* If you want Auto Scaling to scale instances in the scaling group based on the instance type weight, you must specify both the InstanceType and WeightedCapacity parameters.
*
* > This parameter takes effect only after you specify the LaunchTemplateId parameter.
*
* You can use the InstanceType parameter to specify only instance types that are available for purchase.
*/
public Builder instanceType(String instanceType) {
this.instanceType = instanceType;
return this;
}
/**
* SpotPriceLimit.
*/
public Builder spotPriceLimit(Float spotPriceLimit) {
this.spotPriceLimit = spotPriceLimit;
return this;
}
/**
* The weight of the instance type. The weight specifies the capacity of a single instance of the specified instance type in the scaling group. If you want Auto Scaling to scale instances in the scaling group based on the weighted capacity of instances, you must specify the WeightedCapacity parameter after you specify the InstanceType parameter.
*
*
* A higher weight specifies that a smaller number of instances of the specified instance type are required to meet the expected capacity.
*
* Performance metrics, such as the number of vCPUs and the memory size of each instance type, may vary. You can specify different weights for different instance types based on your business requirements.
*
* Example:
*
* * Current capacity: 0
* * Expected capacity: 6
* * Capacity of ecs.c5.xlarge: 4
*
* To meet the expected capacity requirement, Auto Scaling must create and add two ecs.c5.xlarge instances.
*
* > The capacity of the scaling group cannot exceed the sum of the maximum number of instances that is specified by the MaxSize parameter and the maximum weight of the instance type.
*
* Valid values of the WeightedCapacity parameter: 1 to 500.
*/
public Builder weightedCapacity(Integer weightedCapacity) {
this.weightedCapacity = weightedCapacity;
return this;
}
public LaunchTemplateOverrides build() {
return new LaunchTemplateOverrides(this);
}
}
}
}