Class AsgCapacityProviderProps.Builder
java.lang.Object
software.amazon.awscdk.services.ecs.AsgCapacityProviderProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<AsgCapacityProviderProps>
- Enclosing interface:
- AsgCapacityProviderProps
@Stability(Stable)
public static final class AsgCapacityProviderProps.Builder
extends Object
implements software.amazon.jsii.Builder<AsgCapacityProviderProps>
A builder for
AsgCapacityProviderProps
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionautoScalingGroup
(IAutoScalingGroup autoScalingGroup) Sets the value ofAsgCapacityProviderProps.getAutoScalingGroup()
build()
Builds the configured instance.canContainersAccessInstanceRole
(Boolean canContainersAccessInstanceRole) Sets the value ofAddAutoScalingGroupCapacityOptions.getCanContainersAccessInstanceRole()
capacityProviderName
(String capacityProviderName) Sets the value ofAsgCapacityProviderProps.getCapacityProviderName()
enableManagedScaling
(Boolean enableManagedScaling) Sets the value ofAsgCapacityProviderProps.getEnableManagedScaling()
enableManagedTerminationProtection
(Boolean enableManagedTerminationProtection) Sets the value ofAsgCapacityProviderProps.getEnableManagedTerminationProtection()
machineImageType
(MachineImageType machineImageType) Sets the value ofAddAutoScalingGroupCapacityOptions.getMachineImageType()
maximumScalingStepSize
(Number maximumScalingStepSize) Sets the value ofAsgCapacityProviderProps.getMaximumScalingStepSize()
minimumScalingStepSize
(Number minimumScalingStepSize) Sets the value ofAsgCapacityProviderProps.getMinimumScalingStepSize()
spotInstanceDraining
(Boolean spotInstanceDraining) Sets the value ofAddAutoScalingGroupCapacityOptions.getSpotInstanceDraining()
targetCapacityPercent
(Number targetCapacityPercent) Sets the value ofAsgCapacityProviderProps.getTargetCapacityPercent()
taskDrainTime
(Duration taskDrainTime) Deprecated.The lifecycle draining hook is not configured if using the EC2 Capacity Provider.topicEncryptionKey
(IKey topicEncryptionKey) Sets the value ofAddAutoScalingGroupCapacityOptions.getTopicEncryptionKey()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
autoScalingGroup
@Stability(Stable) public AsgCapacityProviderProps.Builder autoScalingGroup(IAutoScalingGroup autoScalingGroup) Sets the value ofAsgCapacityProviderProps.getAutoScalingGroup()
- Parameters:
autoScalingGroup
- The autoscaling group to add as a Capacity Provider. This parameter is required.- Returns:
this
-
capacityProviderName
@Stability(Stable) public AsgCapacityProviderProps.Builder capacityProviderName(String capacityProviderName) Sets the value ofAsgCapacityProviderProps.getCapacityProviderName()
- Parameters:
capacityProviderName
- The name of the capacity provider. If a name is specified, it cannot start withaws
,ecs
, orfargate
. If no name is specified, a default name in the CFNStackName-CFNResourceName-RandomString format is used.- Returns:
this
-
enableManagedScaling
@Stability(Stable) public AsgCapacityProviderProps.Builder enableManagedScaling(Boolean enableManagedScaling) Sets the value ofAsgCapacityProviderProps.getEnableManagedScaling()
- Parameters:
enableManagedScaling
- Whether to enable managed scaling.- Returns:
this
-
enableManagedTerminationProtection
@Stability(Stable) public AsgCapacityProviderProps.Builder enableManagedTerminationProtection(Boolean enableManagedTerminationProtection) Sets the value ofAsgCapacityProviderProps.getEnableManagedTerminationProtection()
- Parameters:
enableManagedTerminationProtection
- Whether to enable managed termination protection.- Returns:
this
-
maximumScalingStepSize
@Stability(Stable) public AsgCapacityProviderProps.Builder maximumScalingStepSize(Number maximumScalingStepSize) Sets the value ofAsgCapacityProviderProps.getMaximumScalingStepSize()
- Parameters:
maximumScalingStepSize
- Maximum scaling step size. In most cases this should be left alone.- Returns:
this
-
minimumScalingStepSize
@Stability(Stable) public AsgCapacityProviderProps.Builder minimumScalingStepSize(Number minimumScalingStepSize) Sets the value ofAsgCapacityProviderProps.getMinimumScalingStepSize()
- Parameters:
minimumScalingStepSize
- Minimum scaling step size. In most cases this should be left alone.- Returns:
this
-
targetCapacityPercent
@Stability(Stable) public AsgCapacityProviderProps.Builder targetCapacityPercent(Number targetCapacityPercent) Sets the value ofAsgCapacityProviderProps.getTargetCapacityPercent()
- Parameters:
targetCapacityPercent
- Target capacity percent. In most cases this should be left alone.- Returns:
this
-
canContainersAccessInstanceRole
@Stability(Stable) public AsgCapacityProviderProps.Builder canContainersAccessInstanceRole(Boolean canContainersAccessInstanceRole) Sets the value ofAddAutoScalingGroupCapacityOptions.getCanContainersAccessInstanceRole()
- Parameters:
canContainersAccessInstanceRole
- Specifies whether the containers can access the container instance role.- Returns:
this
-
machineImageType
@Stability(Stable) public AsgCapacityProviderProps.Builder machineImageType(MachineImageType machineImageType) Sets the value ofAddAutoScalingGroupCapacityOptions.getMachineImageType()
- Parameters:
machineImageType
- What type of machine image this is. Depending on the setting, different UserData will automatically be added to theAutoScalingGroup
to configure it properly for use with ECS.If you create an
AutoScalingGroup
yourself and are adding it viaaddAutoScalingGroup()
, you must specify this value. If you are adding anautoScalingGroup
viaaddCapacity
, this value will be determined from themachineImage
you pass.- Returns:
this
-
spotInstanceDraining
@Stability(Stable) public AsgCapacityProviderProps.Builder spotInstanceDraining(Boolean spotInstanceDraining) Sets the value ofAddAutoScalingGroupCapacityOptions.getSpotInstanceDraining()
- Parameters:
spotInstanceDraining
- Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services. For more information, see Using Spot Instances.- Returns:
this
-
taskDrainTime
@Stability(Deprecated) @Deprecated public AsgCapacityProviderProps.Builder taskDrainTime(Duration taskDrainTime) Deprecated.The lifecycle draining hook is not configured if using the EC2 Capacity Provider. Enable managed termination protection instead.Sets the value ofAddAutoScalingGroupCapacityOptions.getTaskDrainTime()
- Parameters:
taskDrainTime
- The time period to wait before force terminating an instance that is draining. This creates a Lambda function that is used by a lifecycle hook for the AutoScalingGroup that will delay instance termination until all ECS tasks have drained from the instance. Set to 0 to disable task draining.Set to 0 to disable task draining.
- Returns:
this
-
topicEncryptionKey
@Stability(Stable) public AsgCapacityProviderProps.Builder topicEncryptionKey(IKey topicEncryptionKey) Sets the value ofAddAutoScalingGroupCapacityOptions.getTopicEncryptionKey()
- Parameters:
topicEncryptionKey
- IfAddAutoScalingGroupCapacityOptions.taskDrainTime
is non-zero, then the ECS cluster creates an SNS Topic to as part of a system to drain instances of tasks when the instance is being shut down. If this property is provided, then this key will be used to encrypt the contents of that SNS Topic. See [SNS Data Encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-data-encryption.html) for more information.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<AsgCapacityProviderProps>
- Returns:
- a new instance of
AsgCapacityProviderProps
- Throws:
NullPointerException
- if any required attribute was not provided
-