/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.autoscaling.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class PutLifecycleHookRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** *
* The name of the lifecycle hook. *
*/ private String lifecycleHookName; /** ** The name of the Auto Scaling group. *
*/ private String autoScalingGroupName; /** ** 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
.
*
* Required for new lifecycle hooks, but optional when updating existing hooks. *
*/ private String lifecycleTransition; /** ** The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. *
** Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. Required for new lifecycle * hooks, but optional when updating existing hooks. *
*/ private String roleARN; /** ** The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling uses to notify you when an * instance is in a wait state for the lifecycle hook. You can specify either an Amazon SNS topic or an Amazon SQS * queue. *
** If you specify an empty string, this overrides the current ARN. *
** This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key-value * pair format when sending notifications to an Amazon SNS topic. *
*
* When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages contain
* the following additional key-value pair: "Event": "autoscaling:TEST_NOTIFICATION"
.
*
* Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the * notification target. *
*/ private String notificationMetadata; /** *
* 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).
*
* 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
*
* The name of the lifecycle hook. *
* * @param lifecycleHookName * The name of the lifecycle hook. */ public void setLifecycleHookName(String lifecycleHookName) { this.lifecycleHookName = lifecycleHookName; } /** ** The name of the lifecycle hook. *
* * @return The name of the lifecycle hook. */ public String getLifecycleHookName() { return this.lifecycleHookName; } /** ** The name of the lifecycle hook. *
* * @param lifecycleHookName * The name of the lifecycle hook. * @return Returns a reference to this object so that method calls can be chained together. */ public PutLifecycleHookRequest withLifecycleHookName(String lifecycleHookName) { setLifecycleHookName(lifecycleHookName); return this; } /** ** The name of the Auto Scaling group. *
* * @param autoScalingGroupName * The name of the Auto Scaling group. */ public void setAutoScalingGroupName(String autoScalingGroupName) { this.autoScalingGroupName = autoScalingGroupName; } /** ** The name of the Auto Scaling group. *
* * @return The name of the Auto Scaling group. */ public String getAutoScalingGroupName() { return this.autoScalingGroupName; } /** ** The name of the Auto Scaling group. *
* * @param autoScalingGroupName * The name of the Auto Scaling group. * @return Returns a reference to this object so that method calls can be chained together. */ public PutLifecycleHookRequest withAutoScalingGroupName(String autoScalingGroupName) { setAutoScalingGroupName(autoScalingGroupName); return this; } /** ** 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
.
*
* Required for new lifecycle hooks, but optional when updating existing hooks. *
* * @param lifecycleTransition * 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
.
*
* Required for new lifecycle hooks, but optional when updating existing hooks. */ public void setLifecycleTransition(String lifecycleTransition) { this.lifecycleTransition = lifecycleTransition; } /** *
* 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
.
*
* Required for new lifecycle hooks, but optional when updating existing hooks. *
* * @return 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
* .
*
* Required for new lifecycle hooks, but optional when updating existing hooks. */ public String getLifecycleTransition() { return this.lifecycleTransition; } /** *
* 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
.
*
* Required for new lifecycle hooks, but optional when updating existing hooks. *
* * @param lifecycleTransition * 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
.
*
* Required for new lifecycle hooks, but optional when updating existing hooks. * @return Returns a reference to this object so that method calls can be chained together. */ public PutLifecycleHookRequest withLifecycleTransition(String lifecycleTransition) { setLifecycleTransition(lifecycleTransition); return this; } /** *
* The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. *
** Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. Required for new lifecycle * hooks, but optional when updating existing hooks. *
* * @param roleARN * The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification * target. ** Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. Required for new * lifecycle hooks, but optional when updating existing hooks. */ public void setRoleARN(String roleARN) { this.roleARN = roleARN; } /** *
* The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. *
** Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. Required for new lifecycle * hooks, but optional when updating existing hooks. *
* * @return The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification * target. ** Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. Required for new * lifecycle hooks, but optional when updating existing hooks. */ public String getRoleARN() { return this.roleARN; } /** *
* The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. *
** Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. Required for new lifecycle * hooks, but optional when updating existing hooks. *
* * @param roleARN * The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification * target. ** Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. Required for new * lifecycle hooks, but optional when updating existing hooks. * @return Returns a reference to this object so that method calls can be chained together. */ public PutLifecycleHookRequest withRoleARN(String roleARN) { setRoleARN(roleARN); return this; } /** *
* The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling uses to notify you when an * instance is in a wait state for the lifecycle hook. You can specify either an Amazon SNS topic or an Amazon SQS * queue. *
** If you specify an empty string, this overrides the current ARN. *
** This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key-value * pair format when sending notifications to an Amazon SNS topic. *
*
* When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages contain
* the following additional key-value pair: "Event": "autoscaling:TEST_NOTIFICATION"
.
*
* If you specify an empty string, this overrides the current ARN. *
** This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email * key-value pair format when sending notifications to an Amazon SNS topic. *
*
* When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages
* contain the following additional key-value pair: "Event": "autoscaling:TEST_NOTIFICATION"
.
*/
public void setNotificationTargetARN(String notificationTargetARN) {
this.notificationTargetARN = notificationTargetARN;
}
/**
*
* The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling uses to notify you when an * instance is in a wait state for the lifecycle hook. You can specify either an Amazon SNS topic or an Amazon SQS * queue. *
** If you specify an empty string, this overrides the current ARN. *
** This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key-value * pair format when sending notifications to an Amazon SNS topic. *
*
* When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages contain
* the following additional key-value pair: "Event": "autoscaling:TEST_NOTIFICATION"
.
*
* If you specify an empty string, this overrides the current ARN. *
** This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email * key-value pair format when sending notifications to an Amazon SNS topic. *
*
* When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages
* contain the following additional key-value pair: "Event": "autoscaling:TEST_NOTIFICATION"
.
*/
public String getNotificationTargetARN() {
return this.notificationTargetARN;
}
/**
*
* The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling uses to notify you when an * instance is in a wait state for the lifecycle hook. You can specify either an Amazon SNS topic or an Amazon SQS * queue. *
** If you specify an empty string, this overrides the current ARN. *
** This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key-value * pair format when sending notifications to an Amazon SNS topic. *
*
* When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages contain
* the following additional key-value pair: "Event": "autoscaling:TEST_NOTIFICATION"
.
*
* If you specify an empty string, this overrides the current ARN. *
** This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email * key-value pair format when sending notifications to an Amazon SNS topic. *
*
* When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages
* contain the following additional key-value pair: "Event": "autoscaling:TEST_NOTIFICATION"
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutLifecycleHookRequest withNotificationTargetARN(String notificationTargetARN) {
setNotificationTargetARN(notificationTargetARN);
return this;
}
/**
*
* Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the * notification target. *
* * @param notificationMetadata * Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the * notification target. */ public void setNotificationMetadata(String notificationMetadata) { this.notificationMetadata = notificationMetadata; } /** ** Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the * notification target. *
* * @return Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the * notification target. */ public String getNotificationMetadata() { return this.notificationMetadata; } /** ** Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the * notification target. *
* * @param notificationMetadata * Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the * notification target. * @return Returns a reference to this object so that method calls can be chained together. */ public PutLifecycleHookRequest withNotificationMetadata(String notificationMetadata) { setNotificationMetadata(notificationMetadata); return this; } /** *
* 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).
*
30
to 7200
seconds. The default value is 3600
seconds (1 hour).
*/
public void setHeartbeatTimeout(Integer heartbeatTimeout) {
this.heartbeatTimeout = heartbeatTimeout;
}
/**
*
* 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).
*
30
to 7200
seconds. The default value is 3600
seconds (1 hour).
*/
public Integer getHeartbeatTimeout() {
return this.heartbeatTimeout;
}
/**
*
* 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).
*
30
to 7200
seconds. The default value is 3600
seconds (1 hour).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutLifecycleHookRequest withHeartbeatTimeout(Integer heartbeatTimeout) {
setHeartbeatTimeout(heartbeatTimeout);
return this;
}
/**
*
* 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
*
ABANDON
.
*
* Valid values: CONTINUE
| ABANDON
*/
public void setDefaultResult(String defaultResult) {
this.defaultResult = defaultResult;
}
/**
*
* 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
*
ABANDON
.
*
* Valid values: CONTINUE
| ABANDON
*/
public String getDefaultResult() {
return this.defaultResult;
}
/**
*
* 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
*
ABANDON
.
*
* Valid values: CONTINUE
| ABANDON
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutLifecycleHookRequest withDefaultResult(String defaultResult) {
setDefaultResult(defaultResult);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getLifecycleHookName() != null)
sb.append("LifecycleHookName: ").append(getLifecycleHookName()).append(",");
if (getAutoScalingGroupName() != null)
sb.append("AutoScalingGroupName: ").append(getAutoScalingGroupName()).append(",");
if (getLifecycleTransition() != null)
sb.append("LifecycleTransition: ").append(getLifecycleTransition()).append(",");
if (getRoleARN() != null)
sb.append("RoleARN: ").append(getRoleARN()).append(",");
if (getNotificationTargetARN() != null)
sb.append("NotificationTargetARN: ").append(getNotificationTargetARN()).append(",");
if (getNotificationMetadata() != null)
sb.append("NotificationMetadata: ").append(getNotificationMetadata()).append(",");
if (getHeartbeatTimeout() != null)
sb.append("HeartbeatTimeout: ").append(getHeartbeatTimeout()).append(",");
if (getDefaultResult() != null)
sb.append("DefaultResult: ").append(getDefaultResult());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof PutLifecycleHookRequest == false)
return false;
PutLifecycleHookRequest other = (PutLifecycleHookRequest) obj;
if (other.getLifecycleHookName() == null ^ this.getLifecycleHookName() == null)
return false;
if (other.getLifecycleHookName() != null && other.getLifecycleHookName().equals(this.getLifecycleHookName()) == false)
return false;
if (other.getAutoScalingGroupName() == null ^ this.getAutoScalingGroupName() == null)
return false;
if (other.getAutoScalingGroupName() != null && other.getAutoScalingGroupName().equals(this.getAutoScalingGroupName()) == false)
return false;
if (other.getLifecycleTransition() == null ^ this.getLifecycleTransition() == null)
return false;
if (other.getLifecycleTransition() != null && other.getLifecycleTransition().equals(this.getLifecycleTransition()) == false)
return false;
if (other.getRoleARN() == null ^ this.getRoleARN() == null)
return false;
if (other.getRoleARN() != null && other.getRoleARN().equals(this.getRoleARN()) == false)
return false;
if (other.getNotificationTargetARN() == null ^ this.getNotificationTargetARN() == null)
return false;
if (other.getNotificationTargetARN() != null && other.getNotificationTargetARN().equals(this.getNotificationTargetARN()) == false)
return false;
if (other.getNotificationMetadata() == null ^ this.getNotificationMetadata() == null)
return false;
if (other.getNotificationMetadata() != null && other.getNotificationMetadata().equals(this.getNotificationMetadata()) == false)
return false;
if (other.getHeartbeatTimeout() == null ^ this.getHeartbeatTimeout() == null)
return false;
if (other.getHeartbeatTimeout() != null && other.getHeartbeatTimeout().equals(this.getHeartbeatTimeout()) == false)
return false;
if (other.getDefaultResult() == null ^ this.getDefaultResult() == null)
return false;
if (other.getDefaultResult() != null && other.getDefaultResult().equals(this.getDefaultResult()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getLifecycleHookName() == null) ? 0 : getLifecycleHookName().hashCode());
hashCode = prime * hashCode + ((getAutoScalingGroupName() == null) ? 0 : getAutoScalingGroupName().hashCode());
hashCode = prime * hashCode + ((getLifecycleTransition() == null) ? 0 : getLifecycleTransition().hashCode());
hashCode = prime * hashCode + ((getRoleARN() == null) ? 0 : getRoleARN().hashCode());
hashCode = prime * hashCode + ((getNotificationTargetARN() == null) ? 0 : getNotificationTargetARN().hashCode());
hashCode = prime * hashCode + ((getNotificationMetadata() == null) ? 0 : getNotificationMetadata().hashCode());
hashCode = prime * hashCode + ((getHeartbeatTimeout() == null) ? 0 : getHeartbeatTimeout().hashCode());
hashCode = prime * hashCode + ((getDefaultResult() == null) ? 0 : getDefaultResult().hashCode());
return hashCode;
}
@Override
public PutLifecycleHookRequest clone() {
return (PutLifecycleHookRequest) super.clone();
}
}