Class Ec2ServiceProps.Builder
java.lang.Object
software.amazon.awscdk.services.ecs.Ec2ServiceProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<Ec2ServiceProps>
- Enclosing interface:
Ec2ServiceProps
@Stability(Stable)
public static final class Ec2ServiceProps.Builder
extends Object
implements software.amazon.jsii.Builder<Ec2ServiceProps>
A builder for
Ec2ServiceProps
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionassignPublicIp
(Boolean assignPublicIp) Sets the value ofEc2ServiceProps.getAssignPublicIp()
build()
Builds the configured instance.capacityProviderStrategies
(List<? extends CapacityProviderStrategy> capacityProviderStrategies) Sets the value ofBaseServiceOptions.getCapacityProviderStrategies()
circuitBreaker
(DeploymentCircuitBreaker circuitBreaker) Sets the value ofBaseServiceOptions.getCircuitBreaker()
cloudMapOptions
(CloudMapOptions cloudMapOptions) Sets the value ofBaseServiceOptions.getCloudMapOptions()
Sets the value ofBaseServiceOptions.getCluster()
Sets the value ofEc2ServiceProps.getDaemon()
deploymentAlarms
(DeploymentAlarmConfig deploymentAlarms) Sets the value ofBaseServiceOptions.getDeploymentAlarms()
deploymentController
(DeploymentController deploymentController) Sets the value ofBaseServiceOptions.getDeploymentController()
desiredCount
(Number desiredCount) Sets the value ofBaseServiceOptions.getDesiredCount()
enableEcsManagedTags
(Boolean enableEcsManagedTags) Sets the value ofinvalid @link
Ec2ServiceProps#getEnableEcsManagedTags
enableExecuteCommand
(Boolean enableExecuteCommand) Sets the value ofBaseServiceOptions.getEnableExecuteCommand()
healthCheckGracePeriod
(Duration healthCheckGracePeriod) Sets the value ofBaseServiceOptions.getHealthCheckGracePeriod()
maxHealthyPercent
(Number maxHealthyPercent) Sets the value ofBaseServiceOptions.getMaxHealthyPercent()
minHealthyPercent
(Number minHealthyPercent) Sets the value ofBaseServiceOptions.getMinHealthyPercent()
placementConstraints
(List<? extends PlacementConstraint> placementConstraints) Sets the value ofEc2ServiceProps.getPlacementConstraints()
placementStrategies
(List<? extends PlacementStrategy> placementStrategies) Sets the value ofEc2ServiceProps.getPlacementStrategies()
propagateTags
(PropagatedTagSource propagateTags) Sets the value ofBaseServiceOptions.getPropagateTags()
securityGroups
(List<? extends ISecurityGroup> securityGroups) Sets the value ofEc2ServiceProps.getSecurityGroups()
serviceConnectConfiguration
(ServiceConnectProps serviceConnectConfiguration) Sets the value ofBaseServiceOptions.getServiceConnectConfiguration()
serviceName
(String serviceName) Sets the value ofBaseServiceOptions.getServiceName()
taskDefinition
(TaskDefinition taskDefinition) Sets the value ofEc2ServiceProps.getTaskDefinition()
taskDefinitionRevision
(TaskDefinitionRevision taskDefinitionRevision) Sets the value ofBaseServiceOptions.getTaskDefinitionRevision()
volumeConfigurations
(List<? extends ServiceManagedVolume> volumeConfigurations) Sets the value ofBaseServiceOptions.getVolumeConfigurations()
vpcSubnets
(SubnetSelection vpcSubnets) Sets the value ofEc2ServiceProps.getVpcSubnets()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
taskDefinition
Sets the value ofEc2ServiceProps.getTaskDefinition()
- Parameters:
taskDefinition
- The task definition to use for tasks in the service. This parameter is required. [disable-awslint:ref-via-interface]- Returns:
this
-
assignPublicIp
Sets the value ofEc2ServiceProps.getAssignPublicIp()
- Parameters:
assignPublicIp
- Specifies whether the task's elastic network interface receives a public IP address. If true, each task will receive a public IP address.This property is only used for tasks that use the awsvpc network mode.
- Returns:
this
-
daemon
Sets the value ofEc2ServiceProps.getDaemon()
- Parameters:
daemon
- Specifies whether the service will use the daemon scheduling strategy. If true, the service scheduler deploys exactly one task on each container instance in your cluster.When you are using this strategy, do not specify a desired number of tasks or any task placement strategies.
- Returns:
this
-
placementConstraints
@Stability(Stable) public Ec2ServiceProps.Builder placementConstraints(List<? extends PlacementConstraint> placementConstraints) Sets the value ofEc2ServiceProps.getPlacementConstraints()
- Parameters:
placementConstraints
- The placement constraints to use for tasks in the service. For more information, see Amazon ECS Task Placement Constraints.- Returns:
this
-
placementStrategies
@Stability(Stable) public Ec2ServiceProps.Builder placementStrategies(List<? extends PlacementStrategy> placementStrategies) Sets the value ofEc2ServiceProps.getPlacementStrategies()
- Parameters:
placementStrategies
- The placement strategies to use for tasks in the service. For more information, see Amazon ECS Task Placement Strategies.- Returns:
this
-
securityGroups
@Stability(Stable) public Ec2ServiceProps.Builder securityGroups(List<? extends ISecurityGroup> securityGroups) Sets the value ofEc2ServiceProps.getSecurityGroups()
- Parameters:
securityGroups
- The security groups to associate with the service. If you do not specify a security group, a new security group is created.This property is only used for tasks that use the awsvpc network mode.
- Returns:
this
-
vpcSubnets
Sets the value ofEc2ServiceProps.getVpcSubnets()
- Parameters:
vpcSubnets
- The subnets to associate with the service. This property is only used for tasks that use the awsvpc network mode.- Returns:
this
-
cluster
Sets the value ofBaseServiceOptions.getCluster()
- Parameters:
cluster
- The name of the cluster that hosts the service. This parameter is required.- Returns:
this
-
capacityProviderStrategies
@Stability(Stable) public Ec2ServiceProps.Builder capacityProviderStrategies(List<? extends CapacityProviderStrategy> capacityProviderStrategies) Sets the value ofBaseServiceOptions.getCapacityProviderStrategies()
- Parameters:
capacityProviderStrategies
- A list of Capacity Provider strategies used to place a service.- Returns:
this
-
circuitBreaker
@Stability(Stable) public Ec2ServiceProps.Builder circuitBreaker(DeploymentCircuitBreaker circuitBreaker) Sets the value ofBaseServiceOptions.getCircuitBreaker()
- Parameters:
circuitBreaker
- Whether to enable the deployment circuit breaker. If this property is defined, circuit breaker will be implicitly enabled.- Returns:
this
-
cloudMapOptions
Sets the value ofBaseServiceOptions.getCloudMapOptions()
- Parameters:
cloudMapOptions
- The options for configuring an Amazon ECS service to use service discovery.- Returns:
this
-
deploymentAlarms
@Stability(Stable) public Ec2ServiceProps.Builder deploymentAlarms(DeploymentAlarmConfig deploymentAlarms) Sets the value ofBaseServiceOptions.getDeploymentAlarms()
- Parameters:
deploymentAlarms
- The alarm(s) to monitor during deployment, and behavior to apply if at least one enters a state of alarm during the deployment or bake time.- Returns:
this
-
deploymentController
@Stability(Stable) public Ec2ServiceProps.Builder deploymentController(DeploymentController deploymentController) Sets the value ofBaseServiceOptions.getDeploymentController()
- Parameters:
deploymentController
- Specifies which deployment controller to use for the service. For more information, see Amazon ECS Deployment Types- Returns:
this
-
desiredCount
Sets the value ofBaseServiceOptions.getDesiredCount()
- Parameters:
desiredCount
- The desired number of instantiations of the task definition to keep running on the service.- Returns:
this
-
enableEcsManagedTags
@Stability(Stable) public Ec2ServiceProps.Builder enableEcsManagedTags(Boolean enableEcsManagedTags) Sets the value ofinvalid @link
Ec2ServiceProps#getEnableEcsManagedTags
- Parameters:
enableEcsManagedTags
- Specifies whether to enable Amazon ECS managed tags for the tasks within the service. For more information, see Tagging Your Amazon ECS Resources- Returns:
this
-
enableExecuteCommand
@Stability(Stable) public Ec2ServiceProps.Builder enableExecuteCommand(Boolean enableExecuteCommand) Sets the value ofBaseServiceOptions.getEnableExecuteCommand()
- Parameters:
enableExecuteCommand
- Whether to enable the ability to execute into a container.- Returns:
this
-
healthCheckGracePeriod
@Stability(Stable) public Ec2ServiceProps.Builder healthCheckGracePeriod(Duration healthCheckGracePeriod) Sets the value ofBaseServiceOptions.getHealthCheckGracePeriod()
- Parameters:
healthCheckGracePeriod
- The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started.- Returns:
this
-
maxHealthyPercent
Sets the value ofBaseServiceOptions.getMaxHealthyPercent()
- Parameters:
maxHealthyPercent
- The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment.- Returns:
this
-
minHealthyPercent
Sets the value ofBaseServiceOptions.getMinHealthyPercent()
- Parameters:
minHealthyPercent
- The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment.- Returns:
this
-
propagateTags
Sets the value ofBaseServiceOptions.getPropagateTags()
- Parameters:
propagateTags
- Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. Valid values are: PropagatedTagSource.SERVICE, PropagatedTagSource.TASK_DEFINITION or PropagatedTagSource.NONE- Returns:
this
-
serviceConnectConfiguration
@Stability(Stable) public Ec2ServiceProps.Builder serviceConnectConfiguration(ServiceConnectProps serviceConnectConfiguration) Sets the value ofBaseServiceOptions.getServiceConnectConfiguration()
- Parameters:
serviceConnectConfiguration
- Configuration for Service Connect.- Returns:
this
-
serviceName
Sets the value ofBaseServiceOptions.getServiceName()
- Parameters:
serviceName
- The name of the service.- Returns:
this
-
taskDefinitionRevision
@Stability(Stable) public Ec2ServiceProps.Builder taskDefinitionRevision(TaskDefinitionRevision taskDefinitionRevision) Sets the value ofBaseServiceOptions.getTaskDefinitionRevision()
- Parameters:
taskDefinitionRevision
- Revision number for the task definition orlatest
to use the latest active task revision.- Returns:
this
-
volumeConfigurations
@Stability(Stable) public Ec2ServiceProps.Builder volumeConfigurations(List<? extends ServiceManagedVolume> volumeConfigurations) Sets the value ofBaseServiceOptions.getVolumeConfigurations()
- Parameters:
volumeConfigurations
- Configuration details for a volume used by the service. This allows you to specify details about the EBS volume that can be attched to ECS tasks.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<Ec2ServiceProps>
- Returns:
- a new instance of
Ec2ServiceProps
- Throws:
NullPointerException
- if any required attribute was not provided
-