Class: AWSCDK::Autoscaling::Signals

Inherits:
Jsii::Object
  • Object
show all
Defined in:
autoscaling/signals.rb

Overview

Configure whether the AutoScalingGroup waits for signals.

If you do configure waiting for signals, you should make sure the instances invoke cfn-signal somewhere in their UserData to signal that they have started up (either successfully or unsuccessfully).

Signals are used both during intial creation and subsequent updates.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSignals

Returns a new instance of Signals.



14
15
16
# File 'autoscaling/signals.rb', line 14

def initialize
  Jsii::Object.instance_method(:initialize).bind(self).call
end

Class Method Details

.jsii_overridable_methodsObject



18
19
20
21
22
23
# File 'autoscaling/signals.rb', line 18

def self.jsii_overridable_methods
  {
    :do_render => { kind: :method, name: "doRender", is_optional: false },
    :render_creation_policy => { kind: :method, name: "renderCreationPolicy", is_optional: false },
  }
end

.wait_for_all(options = nil) ⇒ AWSCDK::Autoscaling::Signals

Wait for the desiredCapacity of the AutoScalingGroup amount of signals to have been received.

If no desiredCapacity has been configured, wait for minCapacity signals intead.

This number is used during initial creation and during replacing updates. During rolling updates, all updated instances must send a signal.

Parameters:

Returns:

  • (AWSCDK::Autoscaling::Signals)


34
35
36
37
38
# File 'autoscaling/signals.rb', line 34

def self.wait_for_all(options = nil)
  options = options.is_a?(Hash) ? ::AWSCDK::Autoscaling::SignalsOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuU2lnbmFsc09wdGlvbnMifQ==")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_autoscaling.Signals", "waitForAll", [options])
end

.wait_for_count(count, options = nil) ⇒ AWSCDK::Autoscaling::Signals

Wait for a specific amount of signals to have been received.

You should send one signal per instance, so this represents the number of instances to wait for.

This number is used during initial creation and during replacing updates. During rolling updates, all updated instances must send a signal.

Parameters:

Returns:

  • (AWSCDK::Autoscaling::Signals)


51
52
53
54
55
56
# File 'autoscaling/signals.rb', line 51

def self.wait_for_count(count, options = nil)
  Jsii::Type.check_type(count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "count")
  options = options.is_a?(Hash) ? ::AWSCDK::Autoscaling::SignalsOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuU2lnbmFsc09wdGlvbnMifQ==")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_autoscaling.Signals", "waitForCount", [count, options])
end

.wait_for_min_capacity(options = nil) ⇒ AWSCDK::Autoscaling::Signals

Wait for the minCapacity of the AutoScalingGroup amount of signals to have been received.

This number is used during initial creation and during replacing updates. During rolling updates, all updated instances must send a signal.

Parameters:

Returns:

  • (AWSCDK::Autoscaling::Signals)


65
66
67
68
69
# File 'autoscaling/signals.rb', line 65

def self.wait_for_min_capacity(options = nil)
  options = options.is_a?(Hash) ? ::AWSCDK::Autoscaling::SignalsOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuU2lnbmFsc09wdGlvbnMifQ==")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_autoscaling.Signals", "waitForMinCapacity", [options])
end

Instance Method Details

#do_render(options, count = nil) ⇒ AWSCDK::CfnCreationPolicy

Helper to render the actual creation policy, as the logic between them is quite similar.

Parameters:

Returns:



76
77
78
79
80
81
# File 'autoscaling/signals.rb', line 76

def do_render(options, count = nil)
  options = options.is_a?(Hash) ? ::AWSCDK::Autoscaling::SignalsOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuU2lnbmFsc09wdGlvbnMifQ==")), "options")
  Jsii::Type.check_type(count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "count") unless count.nil?
  jsii_call_method("doRender", [options, count])
end

#render_creation_policy(render_options) ⇒ AWSCDK::CfnCreationPolicy

Render the ASG's CreationPolicy.



87
88
89
90
91
# File 'autoscaling/signals.rb', line 87

def render_creation_policy(render_options)
  render_options = render_options.is_a?(Hash) ? ::AWSCDK::Autoscaling::RenderSignalsOptions.new(**render_options.transform_keys(&:to_sym)) : render_options
  Jsii::Type.check_type(render_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuUmVuZGVyU2lnbmFsc09wdGlvbnMifQ==")), "renderOptions")
  jsii_call_method("renderCreationPolicy", [render_options])
end