com.amazonaws.services.elasticmapreduce.model.InstanceResizePolicy Maven / Gradle / Ivy
Show all versions of aws-java-sdk-emr Show documentation
/*
* Copyright 2017-2022 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.elasticmapreduce.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Custom policy for requesting termination protection or termination of specific instances when shrinking an instance
* group.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class InstanceResizePolicy implements Serializable, Cloneable, StructuredPojo {
/**
*
* Specific list of instances to be terminated when shrinking an instance group.
*
*/
private com.amazonaws.internal.SdkInternalList instancesToTerminate;
/**
*
* Specific list of instances to be protected when shrinking an instance group.
*
*/
private com.amazonaws.internal.SdkInternalList instancesToProtect;
/**
*
* Decommissioning timeout override for the specific list of instances to be terminated.
*
*/
private Integer instanceTerminationTimeout;
/**
*
* Specific list of instances to be terminated when shrinking an instance group.
*
*
* @return Specific list of instances to be terminated when shrinking an instance group.
*/
public java.util.List getInstancesToTerminate() {
if (instancesToTerminate == null) {
instancesToTerminate = new com.amazonaws.internal.SdkInternalList();
}
return instancesToTerminate;
}
/**
*
* Specific list of instances to be terminated when shrinking an instance group.
*
*
* @param instancesToTerminate
* Specific list of instances to be terminated when shrinking an instance group.
*/
public void setInstancesToTerminate(java.util.Collection instancesToTerminate) {
if (instancesToTerminate == null) {
this.instancesToTerminate = null;
return;
}
this.instancesToTerminate = new com.amazonaws.internal.SdkInternalList(instancesToTerminate);
}
/**
*
* Specific list of instances to be terminated when shrinking an instance group.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setInstancesToTerminate(java.util.Collection)} or {@link #withInstancesToTerminate(java.util.Collection)}
* if you want to override the existing values.
*
*
* @param instancesToTerminate
* Specific list of instances to be terminated when shrinking an instance group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public InstanceResizePolicy withInstancesToTerminate(String... instancesToTerminate) {
if (this.instancesToTerminate == null) {
setInstancesToTerminate(new com.amazonaws.internal.SdkInternalList(instancesToTerminate.length));
}
for (String ele : instancesToTerminate) {
this.instancesToTerminate.add(ele);
}
return this;
}
/**
*
* Specific list of instances to be terminated when shrinking an instance group.
*
*
* @param instancesToTerminate
* Specific list of instances to be terminated when shrinking an instance group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public InstanceResizePolicy withInstancesToTerminate(java.util.Collection instancesToTerminate) {
setInstancesToTerminate(instancesToTerminate);
return this;
}
/**
*
* Specific list of instances to be protected when shrinking an instance group.
*
*
* @return Specific list of instances to be protected when shrinking an instance group.
*/
public java.util.List getInstancesToProtect() {
if (instancesToProtect == null) {
instancesToProtect = new com.amazonaws.internal.SdkInternalList();
}
return instancesToProtect;
}
/**
*
* Specific list of instances to be protected when shrinking an instance group.
*
*
* @param instancesToProtect
* Specific list of instances to be protected when shrinking an instance group.
*/
public void setInstancesToProtect(java.util.Collection instancesToProtect) {
if (instancesToProtect == null) {
this.instancesToProtect = null;
return;
}
this.instancesToProtect = new com.amazonaws.internal.SdkInternalList(instancesToProtect);
}
/**
*
* Specific list of instances to be protected when shrinking an instance group.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setInstancesToProtect(java.util.Collection)} or {@link #withInstancesToProtect(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param instancesToProtect
* Specific list of instances to be protected when shrinking an instance group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public InstanceResizePolicy withInstancesToProtect(String... instancesToProtect) {
if (this.instancesToProtect == null) {
setInstancesToProtect(new com.amazonaws.internal.SdkInternalList(instancesToProtect.length));
}
for (String ele : instancesToProtect) {
this.instancesToProtect.add(ele);
}
return this;
}
/**
*
* Specific list of instances to be protected when shrinking an instance group.
*
*
* @param instancesToProtect
* Specific list of instances to be protected when shrinking an instance group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public InstanceResizePolicy withInstancesToProtect(java.util.Collection instancesToProtect) {
setInstancesToProtect(instancesToProtect);
return this;
}
/**
*
* Decommissioning timeout override for the specific list of instances to be terminated.
*
*
* @param instanceTerminationTimeout
* Decommissioning timeout override for the specific list of instances to be terminated.
*/
public void setInstanceTerminationTimeout(Integer instanceTerminationTimeout) {
this.instanceTerminationTimeout = instanceTerminationTimeout;
}
/**
*
* Decommissioning timeout override for the specific list of instances to be terminated.
*
*
* @return Decommissioning timeout override for the specific list of instances to be terminated.
*/
public Integer getInstanceTerminationTimeout() {
return this.instanceTerminationTimeout;
}
/**
*
* Decommissioning timeout override for the specific list of instances to be terminated.
*
*
* @param instanceTerminationTimeout
* Decommissioning timeout override for the specific list of instances to be terminated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public InstanceResizePolicy withInstanceTerminationTimeout(Integer instanceTerminationTimeout) {
setInstanceTerminationTimeout(instanceTerminationTimeout);
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 (getInstancesToTerminate() != null)
sb.append("InstancesToTerminate: ").append(getInstancesToTerminate()).append(",");
if (getInstancesToProtect() != null)
sb.append("InstancesToProtect: ").append(getInstancesToProtect()).append(",");
if (getInstanceTerminationTimeout() != null)
sb.append("InstanceTerminationTimeout: ").append(getInstanceTerminationTimeout());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof InstanceResizePolicy == false)
return false;
InstanceResizePolicy other = (InstanceResizePolicy) obj;
if (other.getInstancesToTerminate() == null ^ this.getInstancesToTerminate() == null)
return false;
if (other.getInstancesToTerminate() != null && other.getInstancesToTerminate().equals(this.getInstancesToTerminate()) == false)
return false;
if (other.getInstancesToProtect() == null ^ this.getInstancesToProtect() == null)
return false;
if (other.getInstancesToProtect() != null && other.getInstancesToProtect().equals(this.getInstancesToProtect()) == false)
return false;
if (other.getInstanceTerminationTimeout() == null ^ this.getInstanceTerminationTimeout() == null)
return false;
if (other.getInstanceTerminationTimeout() != null && other.getInstanceTerminationTimeout().equals(this.getInstanceTerminationTimeout()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getInstancesToTerminate() == null) ? 0 : getInstancesToTerminate().hashCode());
hashCode = prime * hashCode + ((getInstancesToProtect() == null) ? 0 : getInstancesToProtect().hashCode());
hashCode = prime * hashCode + ((getInstanceTerminationTimeout() == null) ? 0 : getInstanceTerminationTimeout().hashCode());
return hashCode;
}
@Override
public InstanceResizePolicy clone() {
try {
return (InstanceResizePolicy) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.elasticmapreduce.model.transform.InstanceResizePolicyMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}