Skip to content

LifecycleHook

This class encapsulates and extends the ROS resource type ALIYUN::ESS::LifecycleHook, which is used to create a lifecycle hook for a scaling group.

Initializers

import ros_cdk_ess
ros_cdk_ess.LifecycleHook(
  scope: Construct,
  id: str,
  lifecycle_transition: typing.Union[str, IResolvable],
  scaling_group_id: typing.Union[str, IResolvable],
  default_result: typing.Union[str, IResolvable] = None,
  heartbeat_timeout: typing.Union[typing.Union[int, float], IResolvable] = None,
  lifecycle_hook_name: typing.Union[str, IResolvable] = None,
  notification_arn: typing.Union[str, IResolvable] = None,
  notification_metadata: typing.Union[str, IResolvable] = None,
  enable_resource_property_constraint: bool = None
)
Name Type Description
scope ros_cdk_core.Construct No description.
id str No description.
lifecycle_transition typing.Union[str, ros_cdk_core.IResolvable] Property lifecycleTransition: The scaling activities to which lifecycle hooks apply Value range: SCALE_OUT: scale-out event SCALE_IN: scale-in event.
scaling_group_id typing.Union[str, ros_cdk_core.IResolvable] Property scalingGroupId: The ID of the scaling group.
default_result typing.Union[str, ros_cdk_core.IResolvable] Property defaultResult: The action that the scaling group takes when the lifecycle hook times out.
heartbeat_timeout typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property heartbeatTimeout: The time, in seconds, that can elapse before the lifecycle hook times out.
lifecycle_hook_name typing.Union[str, ros_cdk_core.IResolvable] Property lifecycleHookName: The name of the lifecycle hook.
notification_arn typing.Union[str, ros_cdk_core.IResolvable] Property notificationArn: The Alibaba Cloud Resource Name (ARN) of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook.
notification_metadata typing.Union[str, ros_cdk_core.IResolvable] Property notificationMetadata: The fixed string that you want to include when Auto Scaling sends a message about the wait state of the scaling activity to the notification target.
enable_resource_property_constraint bool No description.

scopeRequired

  • Type: ros_cdk_core.Construct

idRequired

  • Type: str

lifecycle_transitionRequired

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property lifecycleTransition: The scaling activities to which lifecycle hooks apply Value range: SCALE_OUT: scale-out event SCALE_IN: scale-in event.


scaling_group_idRequired

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property scalingGroupId: The ID of the scaling group.


default_resultOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property defaultResult: The action that the scaling group takes when the lifecycle hook times out.

Value range: CONTINUE: the scaling group continues with the scale-in or scale-out process. ABANDON: the scaling group stops any remaining action of the scale-in or scale-out event. Default value: CONTINUE If the scaling group has multiple lifecycle hooks and one of them is terminated by the DefaultResult=ABANDON parameter during a scale-in event (SCALE_IN), the remaining lifecycle hooks under the same scaling group will also be terminated. Otherwise, the action following the wait state is the next action, as specified in the parameter DefaultResult, after the last lifecycle event under the same scaling group.


heartbeat_timeoutOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property heartbeatTimeout: The time, in seconds, that can elapse before the lifecycle hook times out.

If the lifecycle hook times out, the scaling group performs the default action (DefaultResult). The range is from 30 to 86400 seconds. The default value is 600 seconds. You can prevent the lifecycle hook from timing out by calling the RecordLifecycleActionHeartbeat operation. You can also terminate the lifecycle action by calling the CompleteLifecycleAction operation.


lifecycle_hook_nameOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property lifecycleHookName: The name of the lifecycle hook.

Each name must be unique within a scaling group. The name must be 2 to 64 characters in length and can contain letters, numbers, Chinese characters, and special characters including underscores (_), hyphens (-) and periods (.). Default value: Lifecycle Hook ID


notification_arnOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property notificationArn: The Alibaba Cloud Resource Name (ARN) of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook.

This target can be either an MNS queue or an MNS topic. The format of the parameter value is acs:ess:{region}:{account-id}:{resource-relative-id}. region: the region to which the scaling group locates account-id: Alibaba Cloud ID For example: MNS queue: acs:ess:{region}:{account-id}:queue/{queuename} MNS topic: acs:ess:{region}:{account-id}:topic/{topicname} OOS template: acs:ess:{region}:{account-id}:oos/{templatename}


notification_metadataOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property notificationMetadata: The fixed string that you want to include when Auto Scaling sends a message about the wait state of the scaling activity to the notification target.

The length of the parameter can be up to 4096 characters. Auto Scaling will send the specified NotificationMetadata parameter along with the notification message so that you can easily categorize your notifications. The NotificationMetadata parameter will only take effect after you specify the NotificationArn parameter.


enable_resource_property_constraintOptional

  • Type: bool

Methods

Name Description
to_string Returns a string representation of this construct.
synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
add_condition No description.
add_count No description.
add_dependency No description.
add_resource_desc No description.
apply_removal_policy No description.
get_att No description.
set_metadata No description.

to_string

def to_string() -> str

Returns a string representation of this construct.

synthesize

def synthesize(
  session: ISynthesisSession
) -> None

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

sessionRequired

  • Type: ros_cdk_core.ISynthesisSession

The synthesis session.


add_condition

def add_condition(
  condition: RosCondition
) -> None

conditionRequired

  • Type: ros_cdk_core.RosCondition

add_count

def add_count(
  count: typing.Union[typing.Union[int, float], IResolvable]
) -> None

countRequired

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

add_dependency

def add_dependency(
  resource: Resource
) -> None

resourceRequired

  • Type: ros_cdk_core.Resource

add_resource_desc

def add_resource_desc(
  desc: str
) -> None

descRequired

  • Type: str

apply_removal_policy

def apply_removal_policy(
  policy: RemovalPolicy
) -> None

policyRequired

  • Type: ros_cdk_core.RemovalPolicy

get_att

def get_att(
  name: str
) -> IResolvable

nameRequired

  • Type: str

set_metadata

def set_metadata(
  key: str,
  value: typing.Any
) -> None

keyRequired

  • Type: str

valueRequired

  • Type: typing.Any

Static Functions

Name Description
is_construct Return whether the given object is a Construct.

is_construct

import ros_cdk_ess
ros_cdk_ess.LifecycleHook.is_construct(
  x: typing.Any
)

Return whether the given object is a Construct.

xRequired

  • Type: typing.Any

Properties

Name Type Description
node ros_cdk_core.ConstructNode The construct tree node associated with this construct.
ref str No description.
stack ros_cdk_core.Stack The stack in which this resource is defined.
resource ros_cdk_core.RosResource No description.
attr_lifecycle_hook_id ros_cdk_core.IResolvable Attribute LifecycleHookId: The lifecycle hook ID.
attr_scaling_group_id ros_cdk_core.IResolvable Attribute ScalingGroupId: The id of the scaling group to which the lifecycle hook belongs.

nodeRequired

node: ConstructNode
  • Type: ros_cdk_core.ConstructNode

The construct tree node associated with this construct.


refRequired

ref: str
  • Type: str

stackRequired

stack: Stack
  • Type: ros_cdk_core.Stack

The stack in which this resource is defined.


resourceOptional

resource: RosResource
  • Type: ros_cdk_core.RosResource

attr_lifecycle_hook_idRequired

attr_lifecycle_hook_id: IResolvable
  • Type: ros_cdk_core.IResolvable

Attribute LifecycleHookId: The lifecycle hook ID.


attr_scaling_group_idRequired

attr_scaling_group_id: IResolvable
  • Type: ros_cdk_core.IResolvable

Attribute ScalingGroupId: The id of the scaling group to which the lifecycle hook belongs.