Class: AWSCDK::AutoScalingHookTargets::TopicHook

Inherits:
Jsii::Object
  • Object
show all
Includes:
AWSCDK::Autoscaling::ILifecycleHookTarget
Defined in:
auto_scaling_hook_targets/topic_hook.rb

Overview

Use an SNS topic as a hook target.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(topic) ⇒ TopicHook

Returns a new instance of TopicHook.

Parameters:



10
11
12
13
# File 'auto_scaling_hook_targets/topic_hook.rb', line 10

def initialize(topic)
  Jsii::Type.check_type(topic, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc25zLklUb3BpYyJ9")), "topic")
  Jsii::Object.instance_method(:initialize).bind(self).call(topic)
end

Class Method Details

.jsii_overridable_methodsObject



15
16
17
18
19
# File 'auto_scaling_hook_targets/topic_hook.rb', line 15

def self.jsii_overridable_methods
  {
    :bind => { kind: :method, name: "bind", is_optional: false },
  }
end

Instance Method Details

#bind(_scope, options) ⇒ AWSCDK::Autoscaling::LifecycleHookTargetConfig

If an IRole is found in options, grant it topic publishing permissions.

Otherwise, create a new IRole and grant it topic publishing permissions.

Parameters:

Returns:



28
29
30
31
32
33
# File 'auto_scaling_hook_targets/topic_hook.rb', line 28

def bind(_scope, options)
  Jsii::Type.check_type(_scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "_scope")
  options = options.is_a?(Hash) ? ::AWSCDK::Autoscaling::BindHookTargetOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQmluZEhvb2tUYXJnZXRPcHRpb25zIn0=")), "options")
  jsii_call_method("bind", [_scope, options])
end