Class: AWSCDK::ECS::HealthCheck

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs/health_check.rb

Overview

The health check command and associated configuration parameters for the container.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command:, interval: nil, retries: nil, start_period: nil, timeout: nil) ⇒ HealthCheck

Returns a new instance of HealthCheck.

Parameters:

  • command (Array<String>)

    A string array representing the command that the container runs to determine if it is healthy.

  • interval (AWSCDK::Duration, nil) (defaults to: nil)

    The time period in seconds between each health check execution.

  • retries (Numeric, nil) (defaults to: nil)

    The number of times to retry a failed health check before the container is considered unhealthy.

  • start_period (AWSCDK::Duration, nil) (defaults to: nil)

    The optional grace period within which to provide containers time to bootstrap before failed health checks count towards the maximum number of retries.

  • timeout (AWSCDK::Duration, nil) (defaults to: nil)

    The time period in seconds to wait for a health check to succeed before it is considered a failure.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'ecs/health_check.rb', line 12

def initialize(command:, interval: nil, retries: nil, start_period: nil, timeout: nil)
  @command = command
  Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command")
  @interval = interval
  Jsii::Type.check_type(@interval, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "interval") unless @interval.nil?
  @retries = retries
  Jsii::Type.check_type(@retries, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "retries") unless @retries.nil?
  @start_period = start_period
  Jsii::Type.check_type(@start_period, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "startPeriod") unless @start_period.nil?
  @timeout = timeout
  Jsii::Type.check_type(@timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "timeout") unless @timeout.nil?
end

Instance Attribute Details

#commandArray<String> (readonly)

A string array representing the command that the container runs to determine if it is healthy.

The string array must start with CMD to execute the command arguments directly, or CMD-SHELL to run the command with the container's default shell.

For example: [ "CMD-SHELL", "curl -f http://localhost/ || exit 1" ]

Returns:

  • (Array<String>)


33
34
35
# File 'ecs/health_check.rb', line 33

def command
  @command
end

#intervalAWSCDK::Duration? (readonly)

Note:

Default: Duration.seconds(30)

The time period in seconds between each health check execution.

You may specify between 5 and 300 seconds.

Returns:



40
41
42
# File 'ecs/health_check.rb', line 40

def interval
  @interval
end

#retriesNumeric? (readonly)

Note:

Default: 3

The number of times to retry a failed health check before the container is considered unhealthy.

You may specify between 1 and 10 retries.

Returns:

  • (Numeric, nil)


47
48
49
# File 'ecs/health_check.rb', line 47

def retries
  @retries
end

#start_periodAWSCDK::Duration? (readonly)

Note:

Default: No start period

The optional grace period within which to provide containers time to bootstrap before failed health checks count towards the maximum number of retries.

You may specify between 0 and 300 seconds.

Returns:



54
55
56
# File 'ecs/health_check.rb', line 54

def start_period
  @start_period
end

#timeoutAWSCDK::Duration? (readonly)

Note:

Default: Duration.seconds(5)

The time period in seconds to wait for a health check to succeed before it is considered a failure.

You may specify between 2 and 60 seconds.

Returns:



61
62
63
# File 'ecs/health_check.rb', line 61

def timeout
  @timeout
end

Class Method Details

.jsii_propertiesObject



63
64
65
66
67
68
69
70
71
# File 'ecs/health_check.rb', line 63

def self.jsii_properties
  {
    :command => "command",
    :interval => "interval",
    :retries => "retries",
    :start_period => "startPeriod",
    :timeout => "timeout",
  }
end

Instance Method Details

#to_jsiiObject



73
74
75
76
77
78
79
80
81
82
83
# File 'ecs/health_check.rb', line 73

def to_jsii
  result = {}
  result.merge!({
    "command" => @command,
    "interval" => @interval,
    "retries" => @retries,
    "startPeriod" => @start_period,
    "timeout" => @timeout,
  })
  result.compact
end