Class: AWSCDK::Autoscaling::CfnLifecycleHookProps

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

Overview

Properties for defining a CfnLifecycleHook.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auto_scaling_group_name:, lifecycle_transition:, default_result: nil, heartbeat_timeout: nil, lifecycle_hook_name: nil, notification_metadata: nil, notification_target_arn: nil, role_arn: nil) ⇒ CfnLifecycleHookProps

Returns a new instance of CfnLifecycleHookProps.

Parameters:

  • auto_scaling_group_name (String, AWSCDK::Interfaces::AWSAutoscaling::IAutoScalingGroupRef)

    The name of the Auto Scaling group.

  • lifecycle_transition (String)

    The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.

  • default_result (String, nil) (defaults to: nil)

    The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.

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

    The maximum time, in seconds, that can elapse before the lifecycle hook times out.

  • lifecycle_hook_name (String, nil) (defaults to: nil)

    The name of the lifecycle hook.

  • notification_metadata (String, nil) (defaults to: nil)

    Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.

  • notification_target_arn (String, AWSCDK::Interfaces::AWSSNS::ITopicRef, AWSCDK::Interfaces::AWSSQS::IQueueRef, nil) (defaults to: nil)

    The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook.

  • role_arn (String, AWSCDK::Interfaces::AWSIAM::IRoleRef, nil) (defaults to: nil)

    The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 17

def initialize(auto_scaling_group_name:, lifecycle_transition:, default_result: nil, heartbeat_timeout: nil, lifecycle_hook_name: nil, notification_metadata: nil, notification_target_arn: nil, role_arn: nil)
  @auto_scaling_group_name = auto_scaling_group_name
  Jsii::Type.check_type(@auto_scaling_group_name, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hdXRvc2NhbGluZy5JQXV0b1NjYWxpbmdHcm91cFJlZiJ9XX19")), "autoScalingGroupName")
  @lifecycle_transition = lifecycle_transition
  Jsii::Type.check_type(@lifecycle_transition, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "lifecycleTransition")
  @default_result = default_result
  Jsii::Type.check_type(@default_result, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "defaultResult") unless @default_result.nil?
  @heartbeat_timeout = heartbeat_timeout
  Jsii::Type.check_type(@heartbeat_timeout, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "heartbeatTimeout") unless @heartbeat_timeout.nil?
  @lifecycle_hook_name = lifecycle_hook_name
  Jsii::Type.check_type(@lifecycle_hook_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "lifecycleHookName") unless @lifecycle_hook_name.nil?
  @notification_metadata = 
  Jsii::Type.check_type(@notification_metadata, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "notificationMetadata") unless @notification_metadata.nil?
  @notification_target_arn = notification_target_arn
  Jsii::Type.check_type(@notification_target_arn, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19zbnMuSVRvcGljUmVmIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19zcXMuSVF1ZXVlUmVmIn1dfX0=")), "notificationTargetArn") unless @notification_target_arn.nil?
  @role_arn = role_arn
  Jsii::Type.check_type(@role_arn, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19pYW0uSVJvbGVSZWYifV19fQ==")), "roleArn") unless @role_arn.nil?
end

Instance Attribute Details

#auto_scaling_group_nameString, AWSCDK::Interfaces::AWSAutoscaling::IAutoScalingGroupRef (readonly)

The name of the Auto Scaling group.



40
41
42
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 40

def auto_scaling_group_name
  @auto_scaling_group_name
end

#default_resultString? (readonly)

The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.

The default value is ABANDON .

Valid values: CONTINUE | ABANDON



57
58
59
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 57

def default_result
  @default_result
end

#heartbeat_timeoutNumeric? (readonly)

The maximum time, in seconds, that can elapse before the lifecycle hook times out.

The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour).



64
65
66
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 64

def heartbeat_timeout
  @heartbeat_timeout
end

#lifecycle_hook_nameString? (readonly)

The name of the lifecycle hook.



69
70
71
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 69

def lifecycle_hook_name
  @lifecycle_hook_name
end

#lifecycle_transitionString (readonly)

The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.

  • To create a lifecycle hook for scale-out events, specify autoscaling:EC2_INSTANCE_LAUNCHING .
  • To create a lifecycle hook for scale-in events, specify autoscaling:EC2_INSTANCE_TERMINATING .


48
49
50
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 48

def lifecycle_transition
  @lifecycle_transition
end

#notification_metadataString? (readonly)

Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.



74
75
76
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 74

def 
  @notification_metadata
end

#notification_target_arnString, ... (readonly)

The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook.

You can specify an Amazon SNS topic or an Amazon SQS queue.



81
82
83
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 81

def notification_target_arn
  @notification_target_arn
end

#role_arnString, ... (readonly)

The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.

For information about creating this role, see Prepare to add a lifecycle hook to your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide .

Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.



90
91
92
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 90

def role_arn
  @role_arn
end

Class Method Details

.jsii_propertiesObject



92
93
94
95
96
97
98
99
100
101
102
103
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 92

def self.jsii_properties
  {
    :auto_scaling_group_name => "autoScalingGroupName",
    :lifecycle_transition => "lifecycleTransition",
    :default_result => "defaultResult",
    :heartbeat_timeout => "heartbeatTimeout",
    :lifecycle_hook_name => "lifecycleHookName",
    :notification_metadata => "notificationMetadata",
    :notification_target_arn => "notificationTargetArn",
    :role_arn => "roleArn",
  }
end

Instance Method Details

#to_jsiiObject



105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'autoscaling/cfn_lifecycle_hook_props.rb', line 105

def to_jsii
  result = {}
  result.merge!({
    "autoScalingGroupName" => @auto_scaling_group_name,
    "lifecycleTransition" => @lifecycle_transition,
    "defaultResult" => @default_result,
    "heartbeatTimeout" => @heartbeat_timeout,
    "lifecycleHookName" => @lifecycle_hook_name,
    "notificationMetadata" => @notification_metadata,
    "notificationTargetArn" => @notification_target_arn,
    "roleArn" => @role_arn,
  })
  result.compact
end