Class LifecycleHook
- java.lang.Object
-
- com.amazonaws.services.autoscaling.model.LifecycleHook
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class LifecycleHook extends Object implements Serializable, Cloneable
Describes a lifecycle hook, which tells Auto Scaling that you want to perform an action when an instance launches or terminates. When you have a lifecycle hook in place, the Auto Scaling group will either:
- Pause the instance after it launches, but before it is put into service
- Pause the instance as it terminates, but before it is fully terminated
For more information, see Auto Scaling Lifecycle in the Auto Scaling Developer Guide.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LifecycleHook()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LifecycleHook
clone()
boolean
equals(Object obj)
String
getAutoScalingGroupName()
The name of the Auto Scaling group for the lifecycle hook.String
getDefaultResult()
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs.Integer
getGlobalTimeout()
The maximum time, in seconds, that an instance can remain in aPending:Wait
orTerminating:Wait
state.Integer
getHeartbeatTimeout()
The maximum time, in seconds, that can elapse before the lifecycle hook times out.String
getLifecycleHookName()
The name of the lifecycle hook.String
getLifecycleTransition()
The state of the EC2 instance to which you want to attach the lifecycle hook.String
getNotificationMetadata()
Additional information that you want to include any time Auto Scaling sends a message to the notification target.String
getNotificationTargetARN()
The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook.String
getRoleARN()
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.int
hashCode()
void
setAutoScalingGroupName(String autoScalingGroupName)
The name of the Auto Scaling group for the lifecycle hook.void
setDefaultResult(String defaultResult)
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs.void
setGlobalTimeout(Integer globalTimeout)
The maximum time, in seconds, that an instance can remain in aPending:Wait
orTerminating:Wait
state.void
setHeartbeatTimeout(Integer heartbeatTimeout)
The maximum time, in seconds, that can elapse before the lifecycle hook times out.void
setLifecycleHookName(String lifecycleHookName)
The name of the lifecycle hook.void
setLifecycleTransition(String lifecycleTransition)
The state of the EC2 instance to which you want to attach the lifecycle hook.void
setNotificationMetadata(String notificationMetadata)
Additional information that you want to include any time Auto Scaling sends a message to the notification target.void
setNotificationTargetARN(String notificationTargetARN)
The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook.void
setRoleARN(String roleARN)
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.String
toString()
Returns a string representation of this object; useful for testing and debugging.LifecycleHook
withAutoScalingGroupName(String autoScalingGroupName)
The name of the Auto Scaling group for the lifecycle hook.LifecycleHook
withDefaultResult(String defaultResult)
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs.LifecycleHook
withGlobalTimeout(Integer globalTimeout)
The maximum time, in seconds, that an instance can remain in aPending:Wait
orTerminating:Wait
state.LifecycleHook
withHeartbeatTimeout(Integer heartbeatTimeout)
The maximum time, in seconds, that can elapse before the lifecycle hook times out.LifecycleHook
withLifecycleHookName(String lifecycleHookName)
The name of the lifecycle hook.LifecycleHook
withLifecycleTransition(String lifecycleTransition)
The state of the EC2 instance to which you want to attach the lifecycle hook.LifecycleHook
withNotificationMetadata(String notificationMetadata)
Additional information that you want to include any time Auto Scaling sends a message to the notification target.LifecycleHook
withNotificationTargetARN(String notificationTargetARN)
The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook.LifecycleHook
withRoleARN(String roleARN)
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
-
-
-
Method Detail
-
setLifecycleHookName
public void setLifecycleHookName(String lifecycleHookName)
The name of the lifecycle hook.
- Parameters:
lifecycleHookName
- The name of the lifecycle hook.
-
getLifecycleHookName
public String getLifecycleHookName()
The name of the lifecycle hook.
- Returns:
- The name of the lifecycle hook.
-
withLifecycleHookName
public LifecycleHook withLifecycleHookName(String lifecycleHookName)
The name of the lifecycle hook.
- Parameters:
lifecycleHookName
- The name of the lifecycle hook.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setAutoScalingGroupName
public void setAutoScalingGroupName(String autoScalingGroupName)
The name of the Auto Scaling group for the lifecycle hook.
- Parameters:
autoScalingGroupName
- The name of the Auto Scaling group for the lifecycle hook.
-
getAutoScalingGroupName
public String getAutoScalingGroupName()
The name of the Auto Scaling group for the lifecycle hook.
- Returns:
- The name of the Auto Scaling group for the lifecycle hook.
-
withAutoScalingGroupName
public LifecycleHook withAutoScalingGroupName(String autoScalingGroupName)
The name of the Auto Scaling group for the lifecycle hook.
- Parameters:
autoScalingGroupName
- The name of the Auto Scaling group for the lifecycle hook.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setLifecycleTransition
public void setLifecycleTransition(String lifecycleTransition)
The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.
- Parameters:
lifecycleTransition
- The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.
-
getLifecycleTransition
public String getLifecycleTransition()
The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.
- Returns:
- The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.
-
withLifecycleTransition
public LifecycleHook withLifecycleTransition(String lifecycleTransition)
The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.
- Parameters:
lifecycleTransition
- The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setNotificationTargetARN
public void setNotificationTargetARN(String notificationTargetARN)
The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. The notification message sent to the target includes the following:
- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
- Parameters:
notificationTargetARN
- The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. The notification message sent to the target includes the following:- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
-
getNotificationTargetARN
public String getNotificationTargetARN()
The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. The notification message sent to the target includes the following:
- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
- Returns:
- The ARN of the notification target that Auto Scaling uses to
notify you when an instance is in the transition state for the
lifecycle hook. This ARN target can be either an SQS queue or an
SNS topic. The notification message sent to the target includes
the following:
- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
-
withNotificationTargetARN
public LifecycleHook withNotificationTargetARN(String notificationTargetARN)
The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. The notification message sent to the target includes the following:
- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
- Parameters:
notificationTargetARN
- The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. The notification message sent to the target includes the following:- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setRoleARN
public void setRoleARN(String roleARN)
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
- Parameters:
roleARN
- The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
-
getRoleARN
public String getRoleARN()
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
- Returns:
- The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
-
withRoleARN
public LifecycleHook withRoleARN(String roleARN)
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
- Parameters:
roleARN
- The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setNotificationMetadata
public void setNotificationMetadata(String notificationMetadata)
Additional information that you want to include any time Auto Scaling sends a message to the notification target.
- Parameters:
notificationMetadata
- Additional information that you want to include any time Auto Scaling sends a message to the notification target.
-
getNotificationMetadata
public String getNotificationMetadata()
Additional information that you want to include any time Auto Scaling sends a message to the notification target.
- Returns:
- Additional information that you want to include any time Auto Scaling sends a message to the notification target.
-
withNotificationMetadata
public LifecycleHook withNotificationMetadata(String notificationMetadata)
Additional information that you want to include any time Auto Scaling sends a message to the notification target.
- Parameters:
notificationMetadata
- Additional information that you want to include any time Auto Scaling sends a message to the notification target.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setHeartbeatTimeout
public void setHeartbeatTimeout(Integer heartbeatTimeout)
The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.
- Parameters:
heartbeatTimeout
- The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.
-
getHeartbeatTimeout
public Integer getHeartbeatTimeout()
The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.
- Returns:
- The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.
-
withHeartbeatTimeout
public LifecycleHook withHeartbeatTimeout(Integer heartbeatTimeout)
The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.
- Parameters:
heartbeatTimeout
- The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setGlobalTimeout
public void setGlobalTimeout(Integer globalTimeout)
The maximum time, in seconds, that an instance can remain in a
Pending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).- Parameters:
globalTimeout
- The maximum time, in seconds, that an instance can remain in aPending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).
-
getGlobalTimeout
public Integer getGlobalTimeout()
The maximum time, in seconds, that an instance can remain in a
Pending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).- Returns:
- The maximum time, in seconds, that an instance can remain in a
Pending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).
-
withGlobalTimeout
public LifecycleHook withGlobalTimeout(Integer globalTimeout)
The maximum time, in seconds, that an instance can remain in a
Pending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).- Parameters:
globalTimeout
- The maximum time, in seconds, that an instance can remain in aPending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setDefaultResult
public void setDefaultResult(String defaultResult)
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are
CONTINUE
andABANDON
. The default value isCONTINUE
.- Parameters:
defaultResult
- Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values areCONTINUE
andABANDON
. The default value isCONTINUE
.
-
getDefaultResult
public String getDefaultResult()
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are
CONTINUE
andABANDON
. The default value isCONTINUE
.- Returns:
- Defines the action the Auto Scaling group should take when the
lifecycle hook timeout elapses or if an unexpected failure
occurs. The valid values are
CONTINUE
andABANDON
. The default value isCONTINUE
.
-
withDefaultResult
public LifecycleHook withDefaultResult(String defaultResult)
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are
CONTINUE
andABANDON
. The default value isCONTINUE
.- Parameters:
defaultResult
- Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values areCONTINUE
andABANDON
. The default value isCONTINUE
.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
toString
public String toString()
Returns a string representation of this object; useful for testing and debugging.- Overrides:
toString
in classObject
- Returns:
- A string representation of this object.
- See Also:
Object.toString()
-
clone
public LifecycleHook clone()
-
-