Class: AWSCDK::ECSPatterns::ScheduledEC2TaskProps
- Inherits:
-
ScheduledTaskBaseProps
- Object
- ScheduledTaskBaseProps
- AWSCDK::ECSPatterns::ScheduledEC2TaskProps
- Defined in:
- ecs_patterns/scheduled_ec2_task_props.rb
Overview
The properties for the ScheduledEc2Task task.
Instance Attribute Summary collapse
-
#cluster ⇒ AWSCDK::ECS::ICluster?
readonly
The name of the cluster that hosts the service.
-
#desired_task_count ⇒ Numeric?
readonly
The desired number of instantiations of the task definition to keep running on the service.
-
#enabled ⇒ Boolean?
readonly
Indicates whether the rule is enabled.
-
#propagate_tags ⇒ AWSCDK::ECS::PropagatedTagSource?
readonly
Specifies whether to propagate the tags from the task definition to the task.
-
#rule_name ⇒ String?
readonly
A name for the rule.
-
#schedule ⇒ AWSCDK::ApplicationAutoScaling::Schedule
readonly
The schedule or rate (frequency) that determines when CloudWatch Events runs the rule.
-
#scheduled_ec2_task_definition_options ⇒ AWSCDK::ECSPatterns::ScheduledEC2TaskDefinitionOptions?
readonly
The properties to define if using an existing TaskDefinition in this construct.
-
#scheduled_ec2_task_image_options ⇒ AWSCDK::ECSPatterns::ScheduledEC2TaskImageOptions?
readonly
The properties to define if the construct is to create a TaskDefinition.
-
#security_groups ⇒ Array<AWSCDK::EC2::ISecurityGroup>?
readonly
Existing security groups to use for your service.
-
#subnet_selection ⇒ AWSCDK::EC2::SubnetSelection?
readonly
In what subnets to place the task's ENIs.
-
#tags ⇒ Array<AWSCDK::EventsTargets::Tag>?
readonly
The metadata that you apply to the task to help you categorize and organize them.
-
#vpc ⇒ AWSCDK::EC2::IVPC?
readonly
The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(schedule:, cluster: nil, desired_task_count: nil, enabled: nil, propagate_tags: nil, rule_name: nil, security_groups: nil, subnet_selection: nil, tags: nil, vpc: nil, scheduled_ec2_task_definition_options: nil, scheduled_ec2_task_image_options: nil) ⇒ ScheduledEC2TaskProps
constructor
A new instance of ScheduledEC2TaskProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(schedule:, cluster: nil, desired_task_count: nil, enabled: nil, propagate_tags: nil, rule_name: nil, security_groups: nil, subnet_selection: nil, tags: nil, vpc: nil, scheduled_ec2_task_definition_options: nil, scheduled_ec2_task_image_options: nil) ⇒ ScheduledEC2TaskProps
Returns a new instance of ScheduledEC2TaskProps.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 19 def initialize(schedule:, cluster: nil, desired_task_count: nil, enabled: nil, propagate_tags: nil, rule_name: nil, security_groups: nil, subnet_selection: nil, tags: nil, vpc: nil, scheduled_ec2_task_definition_options: nil, scheduled_ec2_task_image_options: nil) @schedule = schedule Jsii::Type.check_type(@schedule, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5TY2hlZHVsZSJ9")), "schedule") @cluster = cluster Jsii::Type.check_type(@cluster, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLklDbHVzdGVyIn0=")), "cluster") unless @cluster.nil? @desired_task_count = desired_task_count Jsii::Type.check_type(@desired_task_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "desiredTaskCount") unless @desired_task_count.nil? @enabled = enabled Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled") unless @enabled.nil? @propagate_tags = Jsii::Type.check_type(@propagate_tags, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlByb3BhZ2F0ZWRUYWdTb3VyY2UifQ==")), "propagateTags") unless @propagate_tags.nil? @rule_name = rule_name Jsii::Type.check_type(@rule_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ruleName") unless @rule_name.nil? @security_groups = security_groups Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil? @subnet_selection = subnet_selection.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**subnet_selection.transform_keys(&:to_sym)) : subnet_selection Jsii::Type.check_type(@subnet_selection, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "subnetSelection") unless @subnet_selection.nil? @tags = .is_a?(Array) ? .map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::EventsTargets::Tag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19ldmVudHNfdGFyZ2V0cy5UYWcifSwia2luZCI6ImFycmF5In19")), "tags") unless @tags.nil? @vpc = vpc Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") unless @vpc.nil? @scheduled_ec2_task_definition_options = .is_a?(Hash) ? ::AWSCDK::ECSPatterns::ScheduledEC2TaskDefinitionOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(@scheduled_ec2_task_definition_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzX3BhdHRlcm5zLlNjaGVkdWxlZEVjMlRhc2tEZWZpbml0aW9uT3B0aW9ucyJ9")), "scheduledEc2TaskDefinitionOptions") unless @scheduled_ec2_task_definition_options.nil? @scheduled_ec2_task_image_options = .is_a?(Hash) ? ::AWSCDK::ECSPatterns::ScheduledEC2TaskImageOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(@scheduled_ec2_task_image_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzX3BhdHRlcm5zLlNjaGVkdWxlZEVjMlRhc2tJbWFnZU9wdGlvbnMifQ==")), "scheduledEc2TaskImageOptions") unless @scheduled_ec2_task_image_options.nil? end |
Instance Attribute Details
#cluster ⇒ AWSCDK::ECS::ICluster? (readonly)
Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you.
The name of the cluster that hosts the service.
If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc.
60 61 62 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 60 def cluster @cluster end |
#desired_task_count ⇒ Numeric? (readonly)
Default: 1
The desired number of instantiations of the task definition to keep running on the service.
65 66 67 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 65 def desired_task_count @desired_task_count end |
#enabled ⇒ Boolean? (readonly)
Default: true
Indicates whether the rule is enabled.
70 71 72 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 70 def enabled @enabled end |
#propagate_tags ⇒ AWSCDK::ECS::PropagatedTagSource? (readonly)
Default: - Tags will not be propagated
Specifies whether to propagate the tags from the task definition to the task.
If no value is specified, the tags are not propagated.
77 78 79 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 77 def @propagate_tags end |
#rule_name ⇒ String? (readonly)
Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the rule name. For more information, see Name Type.
A name for the rule.
82 83 84 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 82 def rule_name @rule_name end |
#schedule ⇒ AWSCDK::ApplicationAutoScaling::Schedule (readonly)
The schedule or rate (frequency) that determines when CloudWatch Events runs the rule.
For more information, see Schedule Expression Syntax for Rules in the Amazon CloudWatch User Guide.
53 54 55 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 53 def schedule @schedule end |
#scheduled_ec2_task_definition_options ⇒ AWSCDK::ECSPatterns::ScheduledEC2TaskDefinitionOptions? (readonly)
Default: none
The properties to define if using an existing TaskDefinition in this construct.
ScheduledEc2TaskDefinitionOptions or ScheduledEc2TaskImageOptions must be defined, but not both.
115 116 117 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 115 def @scheduled_ec2_task_definition_options end |
#scheduled_ec2_task_image_options ⇒ AWSCDK::ECSPatterns::ScheduledEC2TaskImageOptions? (readonly)
Default: none
The properties to define if the construct is to create a TaskDefinition.
ScheduledEc2TaskDefinitionOptions or ScheduledEc2TaskImageOptions must be defined, but not both.
122 123 124 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 122 def @scheduled_ec2_task_image_options end |
#security_groups ⇒ Array<AWSCDK::EC2::ISecurityGroup>? (readonly)
Default: - a new security group will be created.
Existing security groups to use for your service.
87 88 89 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 87 def security_groups @security_groups end |
#subnet_selection ⇒ AWSCDK::EC2::SubnetSelection? (readonly)
Default: Private subnets
In what subnets to place the task's ENIs.
(Only applicable in case the TaskDefinition is configured for AwsVpc networking)
94 95 96 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 94 def subnet_selection @subnet_selection end |
#tags ⇒ Array<AWSCDK::EventsTargets::Tag>? (readonly)
Default: - No tags are applied to the task
The metadata that you apply to the task to help you categorize and organize them.
Each tag consists of a key and an optional value, both of which you define.
101 102 103 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 101 def @tags end |
#vpc ⇒ AWSCDK::EC2::IVPC? (readonly)
Default: - uses the VPC defined in the cluster or creates a new VPC.
The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed.
If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster.
108 109 110 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 108 def vpc @vpc end |
Class Method Details
.jsii_properties ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 124 def self.jsii_properties { :schedule => "schedule", :cluster => "cluster", :desired_task_count => "desiredTaskCount", :enabled => "enabled", :propagate_tags => "propagateTags", :rule_name => "ruleName", :security_groups => "securityGroups", :subnet_selection => "subnetSelection", :tags => "tags", :vpc => "vpc", :scheduled_ec2_task_definition_options => "scheduledEc2TaskDefinitionOptions", :scheduled_ec2_task_image_options => "scheduledEc2TaskImageOptions", } end |
Instance Method Details
#to_jsii ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'ecs_patterns/scheduled_ec2_task_props.rb', line 141 def to_jsii result = {} result.merge!(super) result.merge!({ "schedule" => @schedule, "cluster" => @cluster, "desiredTaskCount" => @desired_task_count, "enabled" => @enabled, "propagateTags" => @propagate_tags, "ruleName" => @rule_name, "securityGroups" => @security_groups, "subnetSelection" => @subnet_selection, "tags" => @tags, "vpc" => @vpc, "scheduledEc2TaskDefinitionOptions" => @scheduled_ec2_task_definition_options, "scheduledEc2TaskImageOptions" => @scheduled_ec2_task_image_options, }) result.compact end |