package awsecs import ( "github.com/aws/aws-cdk-go/awscdk/v2" "github.com/aws/aws-cdk-go/awscdk/v2/awsec2" ) // The properties for defining a service using the Fargate launch type. // // Example: // import cw "github.com/aws/aws-cdk-go/awscdk" // // var cluster cluster // var taskDefinition taskDefinition // var elbAlarm alarm // // // service := ecs.NewFargateService(this, jsii.String("Service"), &FargateServiceProps{ // Cluster: Cluster, // TaskDefinition: TaskDefinition, // DeploymentAlarms: &DeploymentAlarmConfig{ // AlarmNames: []*string{ // elbAlarm.AlarmName, // }, // Behavior: ecs.AlarmBehavior_ROLLBACK_ON_ALARM, // }, // }) // // // Defining a deployment alarm after the service has been created // cpuAlarmName := "MyCpuMetricAlarm" // cw.NewAlarm(this, jsii.String("CPUAlarm"), &AlarmProps{ // AlarmName: cpuAlarmName, // Metric: service.MetricCpuUtilization(), // EvaluationPeriods: jsii.Number(2), // Threshold: jsii.Number(80), // }) // service.EnableDeploymentAlarms([]*string{ // cpuAlarmName, // }, &DeploymentAlarmOptions{ // Behavior: ecs.AlarmBehavior_FAIL_ON_ALARM, // }) // type FargateServiceProps struct { // The name of the cluster that hosts the service. Cluster ICluster `field:"required" json:"cluster" yaml:"cluster"` // A list of Capacity Provider strategies used to place a service. CapacityProviderStrategies *[]*CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategies" yaml:"capacityProviderStrategies"` // Whether to enable the deployment circuit breaker. // // If this property is defined, circuit breaker will be implicitly // enabled. CircuitBreaker *DeploymentCircuitBreaker `field:"optional" json:"circuitBreaker" yaml:"circuitBreaker"` // The options for configuring an Amazon ECS service to use service discovery. CloudMapOptions *CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // 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. DeploymentAlarms *DeploymentAlarmConfig `field:"optional" json:"deploymentAlarms" yaml:"deploymentAlarms"` // Specifies which deployment controller to use for the service. // // For more information, see // [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) DeploymentController *DeploymentController `field:"optional" json:"deploymentController" yaml:"deploymentController"` // The desired number of instantiations of the task definition to keep running on the service. DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether to enable the ability to execute into a container. EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // 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. HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // 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. MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"` // 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. MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"` // 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 PropagateTags PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // Configuration for Service Connect. ServiceConnectConfiguration *ServiceConnectProps `field:"optional" json:"serviceConnectConfiguration" yaml:"serviceConnectConfiguration"` // The name of the service. ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // The task definition to use for tasks in the service. // // [disable-awslint:ref-via-interface]. TaskDefinition TaskDefinition `field:"required" json:"taskDefinition" yaml:"taskDefinition"` // Specifies whether the task's elastic network interface receives a public IP address. // // If true, each task will receive a public IP address. AssignPublicIp *bool `field:"optional" json:"assignPublicIp" yaml:"assignPublicIp"` // The platform version on which to run your service. // // If one is not specified, the LATEST platform version is used by default. For more information, see // [AWS Fargate Platform Versions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) // in the Amazon Elastic Container Service Developer Guide. PlatformVersion FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"` // The security groups to associate with the service. // // If you do not specify a security group, a new security group is created. SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"` // The subnets to associate with the service. VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"` }