Class: AWSCDK::Autoscaling::LifecycleHookProps

Inherits:
BasicLifecycleHookProps
  • Object
show all
Defined in:
autoscaling/lifecycle_hook_props.rb

Overview

Properties for a Lifecycle hook.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lifecycle_transition:, default_result: nil, heartbeat_timeout: nil, lifecycle_hook_name: nil, notification_metadata: nil, notification_target: nil, role: nil, auto_scaling_group:) ⇒ LifecycleHookProps

Returns a new instance of LifecycleHookProps.

Parameters:

  • lifecycle_transition (AWSCDK::Autoscaling::LifecycleTransition)

    The state of the Amazon EC2 instance to which you want to attach the lifecycle hook.

  • default_result (AWSCDK::Autoscaling::DefaultResult, 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 (AWSCDK::Duration, nil) (defaults to: nil)

    Maximum time between calls to RecordLifecycleActionHeartbeat for the hook.

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

    Name of the lifecycle hook.

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

    Additional data to pass to the lifecycle hook target.

  • notification_target (AWSCDK::Autoscaling::ILifecycleHookTarget, nil) (defaults to: nil)

    The target of the lifecycle hook.

  • role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The role that allows publishing to the notification target.

  • auto_scaling_group (AWSCDK::Interfaces::AWSAutoscaling::IAutoScalingGroupRef)

    The AutoScalingGroup to add the lifecycle hook to.



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

def initialize(lifecycle_transition:, default_result: nil, heartbeat_timeout: nil, lifecycle_hook_name: nil, notification_metadata: nil, notification_target: nil, role: nil, auto_scaling_group:)
  @lifecycle_transition = lifecycle_transition
  Jsii::Type.check_type(@lifecycle_transition, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuTGlmZWN5Y2xlVHJhbnNpdGlvbiJ9")), "lifecycleTransition")
  @default_result = default_result
  Jsii::Type.check_type(@default_result, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuRGVmYXVsdFJlc3VsdCJ9")), "defaultResult") unless @default_result.nil?
  @heartbeat_timeout = heartbeat_timeout
  Jsii::Type.check_type(@heartbeat_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "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 = notification_target
  Jsii::Type.check_type(@notification_target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuSUxpZmVjeWNsZUhvb2tUYXJnZXQifQ==")), "notificationTarget") unless @notification_target.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @auto_scaling_group = auto_scaling_group
  Jsii::Type.check_type(@auto_scaling_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hdXRvc2NhbGluZy5JQXV0b1NjYWxpbmdHcm91cFJlZiJ9")), "autoScalingGroup")
end

Instance Attribute Details

#auto_scaling_groupAWSCDK::Interfaces::AWSAutoscaling::IAutoScalingGroupRef (readonly)

The AutoScalingGroup to add the lifecycle hook to.



73
74
75
# File 'autoscaling/lifecycle_hook_props.rb', line 73

def auto_scaling_group
  @auto_scaling_group
end

#default_resultAWSCDK::Autoscaling::DefaultResult? (readonly)

Note:

Default: Continue

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



42
43
44
# File 'autoscaling/lifecycle_hook_props.rb', line 42

def default_result
  @default_result
end

#heartbeat_timeoutAWSCDK::Duration? (readonly)

Note:

Default: - No heartbeat timeout.

Maximum time between calls to RecordLifecycleActionHeartbeat for the hook.

If the lifecycle hook times out, perform the action in DefaultResult.

Returns:



49
50
51
# File 'autoscaling/lifecycle_hook_props.rb', line 49

def heartbeat_timeout
  @heartbeat_timeout
end

#lifecycle_hook_nameString? (readonly)

Note:

Default: - Automatically generated name.

Name of the lifecycle hook.

Returns:

  • (String, nil)


54
55
56
# File 'autoscaling/lifecycle_hook_props.rb', line 54

def lifecycle_hook_name
  @lifecycle_hook_name
end

#lifecycle_transitionAWSCDK::Autoscaling::LifecycleTransition (readonly)

The state of the Amazon EC2 instance to which you want to attach the lifecycle hook.



37
38
39
# File 'autoscaling/lifecycle_hook_props.rb', line 37

def lifecycle_transition
  @lifecycle_transition
end

#notification_metadataString? (readonly)

Note:

Default: - No metadata.

Additional data to pass to the lifecycle hook target.

Returns:

  • (String, nil)


59
60
61
# File 'autoscaling/lifecycle_hook_props.rb', line 59

def 
  @notification_metadata
end

#notification_targetAWSCDK::Autoscaling::ILifecycleHookTarget? (readonly)

Note:

Default: - No target.

The target of the lifecycle hook.



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

def notification_target
  @notification_target
end

#roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - A role will be created if a target is provided. Otherwise, no role is created.

The role that allows publishing to the notification target.

Returns:



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

def role
  @role
end

Class Method Details

.jsii_propertiesObject



75
76
77
78
79
80
81
82
83
84
85
86
# File 'autoscaling/lifecycle_hook_props.rb', line 75

def self.jsii_properties
  {
    :lifecycle_transition => "lifecycleTransition",
    :default_result => "defaultResult",
    :heartbeat_timeout => "heartbeatTimeout",
    :lifecycle_hook_name => "lifecycleHookName",
    :notification_metadata => "notificationMetadata",
    :notification_target => "notificationTarget",
    :role => "role",
    :auto_scaling_group => "autoScalingGroup",
  }
end

Instance Method Details

#to_jsiiObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'autoscaling/lifecycle_hook_props.rb', line 88

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "lifecycleTransition" => @lifecycle_transition,
    "defaultResult" => @default_result,
    "heartbeatTimeout" => @heartbeat_timeout,
    "lifecycleHookName" => @lifecycle_hook_name,
    "notificationMetadata" => @notification_metadata,
    "notificationTarget" => @notification_target,
    "role" => @role,
    "autoScalingGroup" => @auto_scaling_group,
  })
  result.compact
end