Class: AWSCDK::ECS::CfnTaskDefinition::RestartPolicyProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::ECS::CfnTaskDefinition::RestartPolicyProperty
- Defined in:
- ecs/cfn_task_definition.rb
Overview
You can enable a restart policy for each container defined in your task definition, to overcome transient failures faster and maintain task availability.
When you enable a restart policy for a container, Amazon ECS can restart the container if it exits, without needing to replace the task. For more information, see Restart individual containers in Amazon ECS tasks with container restart policies in the Amazon Elastic Container Service Developer Guide .
Instance Attribute Summary collapse
-
#enabled ⇒ Boolean, ...
readonly
Specifies whether a restart policy is enabled for the container.
-
#ignored_exit_codes ⇒ Array<Numeric>, ...
readonly
A list of exit codes that Amazon ECS will ignore and not attempt a restart on.
-
#restart_attempt_period ⇒ Numeric?
readonly
A period of time (in seconds) that the container must run for before a restart can be attempted.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(enabled: nil, ignored_exit_codes: nil, restart_attempt_period: nil) ⇒ RestartPolicyProperty
constructor
A new instance of RestartPolicyProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(enabled: nil, ignored_exit_codes: nil, restart_attempt_period: nil) ⇒ RestartPolicyProperty
Returns a new instance of RestartPolicyProperty.
2970 2971 2972 2973 2974 2975 2976 2977 |
# File 'ecs/cfn_task_definition.rb', line 2970 def initialize(enabled: nil, ignored_exit_codes: nil, restart_attempt_period: nil) @enabled = enabled Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "enabled") unless @enabled.nil? @ignored_exit_codes = ignored_exit_codes Jsii::Type.check_type(@ignored_exit_codes, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siY29sbGVjdGlvbiI6eyJlbGVtZW50dHlwZSI6eyJwcmltaXRpdmUiOiJudW1iZXIifSwia2luZCI6ImFycmF5In19LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "ignoredExitCodes") unless @ignored_exit_codes.nil? @restart_attempt_period = restart_attempt_period Jsii::Type.check_type(@restart_attempt_period, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "restartAttemptPeriod") unless @restart_attempt_period.nil? end |
Instance Attribute Details
#enabled ⇒ Boolean, ... (readonly)
Specifies whether a restart policy is enabled for the container.
2983 2984 2985 |
# File 'ecs/cfn_task_definition.rb', line 2983 def enabled @enabled end |
#ignored_exit_codes ⇒ Array<Numeric>, ... (readonly)
A list of exit codes that Amazon ECS will ignore and not attempt a restart on.
You can specify a maximum of 50 container exit codes. By default, Amazon ECS does not ignore any exit codes.
2990 2991 2992 |
# File 'ecs/cfn_task_definition.rb', line 2990 def ignored_exit_codes @ignored_exit_codes end |
#restart_attempt_period ⇒ Numeric? (readonly)
A period of time (in seconds) that the container must run for before a restart can be attempted.
A container can be restarted only once every restart_attempt_period seconds. If a container isn't able to run for this time period and exits early, it will not be restarted. You can set a minimum restart_attempt_period of 60 seconds and a maximum restart_attempt_period of 1800 seconds. By default, a container must run for 300 seconds before it can be restarted.
2997 2998 2999 |
# File 'ecs/cfn_task_definition.rb', line 2997 def restart_attempt_period @restart_attempt_period end |
Class Method Details
.jsii_properties ⇒ Object
2999 3000 3001 3002 3003 3004 3005 |
# File 'ecs/cfn_task_definition.rb', line 2999 def self.jsii_properties { :enabled => "enabled", :ignored_exit_codes => "ignoredExitCodes", :restart_attempt_period => "restartAttemptPeriod", } end |
Instance Method Details
#to_jsii ⇒ Object
3007 3008 3009 3010 3011 3012 3013 3014 3015 |
# File 'ecs/cfn_task_definition.rb', line 3007 def to_jsii result = {} result.merge!({ "enabled" => @enabled, "ignoredExitCodes" => @ignored_exit_codes, "restartAttemptPeriod" => @restart_attempt_period, }) result.compact end |