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 com.aliyun.ros.cdk.ess.LifecycleHook;
LifecycleHook.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
    .lifecycleTransition(java.lang.String)
    .lifecycleTransition(IResolvable)
    .scalingGroupId(java.lang.String)
    .scalingGroupId(IResolvable)
//  .defaultResult(java.lang.String)
//  .defaultResult(IResolvable)
//  .heartbeatTimeout(java.lang.Number)
//  .heartbeatTimeout(IResolvable)
//  .lifecycleHookName(java.lang.String)
//  .lifecycleHookName(IResolvable)
//  .notificationArn(java.lang.String)
//  .notificationArn(IResolvable)
//  .notificationMetadata(java.lang.String)
//  .notificationMetadata(IResolvable)
    .build();
Name Type Description
scope com.aliyun.ros.cdk.core.Construct No description.
id java.lang.String No description.
enableResourcePropertyConstraint java.lang.Boolean No description.
lifecycleTransition java.lang.String OR com.aliyun.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.
scalingGroupId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property scalingGroupId: The ID of the scaling group.
defaultResult java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property defaultResult: The action that the scaling group takes when the lifecycle hook times out.
heartbeatTimeout java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property heartbeatTimeout: The time, in seconds, that can elapse before the lifecycle hook times out.
lifecycleHookName java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property lifecycleHookName: The name of the lifecycle hook.
notificationArn java.lang.String OR com.aliyun.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.
notificationMetadata java.lang.String OR com.aliyun.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.

scopeRequired

  • Type: com.aliyun.ros.cdk.core.Construct

idRequired

  • Type: java.lang.String

enableResourcePropertyConstraintOptional

  • Type: java.lang.Boolean

lifecycleTransitionRequired

  • Type: java.lang.String OR com.aliyun.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.


scalingGroupIdRequired

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property scalingGroupId: The ID of the scaling group.


defaultResultOptional

  • Type: java.lang.String OR com.aliyun.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.


heartbeatTimeoutOptional

  • Type: java.lang.Number OR com.aliyun.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.


lifecycleHookNameOptional

  • Type: java.lang.String OR com.aliyun.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


notificationArnOptional

  • Type: java.lang.String OR com.aliyun.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}


notificationMetadataOptional

  • Type: java.lang.String OR com.aliyun.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.


Methods

Name Description
toString Returns a string representation of this construct.
synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
addCondition No description.
addCount No description.
addDependency No description.
addResourceDesc No description.
applyRemovalPolicy No description.
getAtt No description.
setMetadata No description.

toString

public java.lang.String toString()

Returns a string representation of this construct.

synthesize

public void synthesize(ISynthesisSession session)

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: com.aliyun.ros.cdk.core.ISynthesisSession

The synthesis session.


addCondition

public void addCondition(RosCondition condition)

conditionRequired

  • Type: com.aliyun.ros.cdk.core.RosCondition

addCount

public void addCount(java.lang.Number OR IResolvable count)

countRequired

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

addDependency

public void addDependency(Resource resource)

resourceRequired

  • Type: com.aliyun.ros.cdk.core.Resource

addResourceDesc

public void addResourceDesc(java.lang.String desc)

descRequired

  • Type: java.lang.String

applyRemovalPolicy

public void applyRemovalPolicy(RemovalPolicy policy)

policyRequired

  • Type: com.aliyun.ros.cdk.core.RemovalPolicy

getAtt

public IResolvable getAtt(java.lang.String name)

nameRequired

  • Type: java.lang.String

setMetadata

public void setMetadata(java.lang.String key, java.lang.Object value)

keyRequired

  • Type: java.lang.String

valueRequired

  • Type: java.lang.Object

Static Functions

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

isConstruct

import com.aliyun.ros.cdk.ess.LifecycleHook;
LifecycleHook.isConstruct(java.lang.Object x)

Return whether the given object is a Construct.

xRequired

  • Type: java.lang.Object

Properties

Name Type Description
node com.aliyun.ros.cdk.core.ConstructNode The construct tree node associated with this construct.
ref java.lang.String No description.
stack com.aliyun.ros.cdk.core.Stack The stack in which this resource is defined.
resource com.aliyun.ros.cdk.core.RosResource No description.
attrLifecycleHookId com.aliyun.ros.cdk.core.IResolvable Attribute LifecycleHookId: The lifecycle hook ID.
attrScalingGroupId com.aliyun.ros.cdk.core.IResolvable Attribute ScalingGroupId: The id of the scaling group to which the lifecycle hook belongs.

nodeRequired

public ConstructNode getNode();
  • Type: com.aliyun.ros.cdk.core.ConstructNode

The construct tree node associated with this construct.


refRequired

public java.lang.String getRef();
  • Type: java.lang.String

stackRequired

public Stack getStack();
  • Type: com.aliyun.ros.cdk.core.Stack

The stack in which this resource is defined.


resourceOptional

public RosResource getResource();
  • Type: com.aliyun.ros.cdk.core.RosResource

attrLifecycleHookIdRequired

public IResolvable getAttrLifecycleHookId();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute LifecycleHookId: The lifecycle hook ID.


attrScalingGroupIdRequired

public IResolvable getAttrScalingGroupId();
  • Type: com.aliyun.ros.cdk.core.IResolvable

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