Class: AWSCDK::EventsTargets::ContainerOverride

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
events_targets/container_override.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container_name:, command: nil, cpu: nil, environment: nil, memory_limit: nil, memory_reservation: nil) ⇒ ContainerOverride

Returns a new instance of ContainerOverride.

Parameters:

  • container_name (String)

    Name of the container inside the task definition.

  • command (Array<String>, nil) (defaults to: nil)

    Command to run inside the container.

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

    The number of cpu units reserved for the container.

  • environment (Array<AWSCDK::EventsTargets::TaskEnvironmentVariable>, nil) (defaults to: nil)

    Variables to set in the container's environment.

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

    Hard memory limit on the container.

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

    Soft memory limit on the container.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'events_targets/container_override.rb', line 12

def initialize(container_name:, command: nil, cpu: nil, environment: nil, memory_limit: nil, memory_reservation: nil)
  @container_name = container_name
  Jsii::Type.check_type(@container_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "containerName")
  @command = command
  Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command") unless @command.nil?
  @cpu = cpu
  Jsii::Type.check_type(@cpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpu") unless @cpu.nil?
  @environment = environment.is_a?(Array) ? environment.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::EventsTargets::TaskEnvironmentVariable.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19ldmVudHNfdGFyZ2V0cy5UYXNrRW52aXJvbm1lbnRWYXJpYWJsZSJ9LCJraW5kIjoiYXJyYXkifX0=")), "environment") unless @environment.nil?
  @memory_limit = memory_limit
  Jsii::Type.check_type(@memory_limit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "memoryLimit") unless @memory_limit.nil?
  @memory_reservation = memory_reservation
  Jsii::Type.check_type(@memory_reservation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "memoryReservation") unless @memory_reservation.nil?
end

Instance Attribute Details

#commandArray<String>? (readonly)

Note:

Default: Default command

Command to run inside the container.

Returns:

  • (Array<String>, nil)


35
36
37
# File 'events_targets/container_override.rb', line 35

def command
  @command
end

#container_nameString (readonly)

Name of the container inside the task definition.

Returns:

  • (String)


30
31
32
# File 'events_targets/container_override.rb', line 30

def container_name
  @container_name
end

#cpuNumeric? (readonly)

Note:

Default: The default value from the task definition.

The number of cpu units reserved for the container.

Returns:

  • (Numeric, nil)


40
41
42
# File 'events_targets/container_override.rb', line 40

def cpu
  @cpu
end

#environmentArray<AWSCDK::EventsTargets::TaskEnvironmentVariable>? (readonly)

Variables to set in the container's environment.



44
45
46
# File 'events_targets/container_override.rb', line 44

def environment
  @environment
end

#memory_limitNumeric? (readonly)

Note:

Default: The default value from the task definition.

Hard memory limit on the container.

Returns:

  • (Numeric, nil)


49
50
51
# File 'events_targets/container_override.rb', line 49

def memory_limit
  @memory_limit
end

#memory_reservationNumeric? (readonly)

Note:

Default: The default value from the task definition.

Soft memory limit on the container.

Returns:

  • (Numeric, nil)


54
55
56
# File 'events_targets/container_override.rb', line 54

def memory_reservation
  @memory_reservation
end

Class Method Details

.jsii_propertiesObject



56
57
58
59
60
61
62
63
64
65
# File 'events_targets/container_override.rb', line 56

def self.jsii_properties
  {
    :container_name => "containerName",
    :command => "command",
    :cpu => "cpu",
    :environment => "environment",
    :memory_limit => "memoryLimit",
    :memory_reservation => "memoryReservation",
  }
end

Instance Method Details

#to_jsiiObject



67
68
69
70
71
72
73
74
75
76
77
78
# File 'events_targets/container_override.rb', line 67

def to_jsii
  result = {}
  result.merge!({
    "containerName" => @container_name,
    "command" => @command,
    "cpu" => @cpu,
    "environment" => @environment,
    "memoryLimit" => @memory_limit,
    "memoryReservation" => @memory_reservation,
  })
  result.compact
end