com.amazonaws.services.ec2.model.SpotOptionsRequest Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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.ec2.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* Describes the configuration of Spot Instances in an EC2 Fleet request.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SpotOptionsRequest implements Serializable, Cloneable {
/**
*
* Indicates how to allocate the target capacity across the Spot pools specified by the Spot Fleet request. The
* default is lowestPrice
.
*
*/
private String allocationStrategy;
/**
*
* The behavior when a Spot Instance is interrupted. The default is terminate
.
*
*/
private String instanceInterruptionBehavior;
/**
*
* Indicates how to allocate the target capacity across the Spot pools specified by the Spot Fleet request. The
* default is lowestPrice
.
*
*
* @param allocationStrategy
* Indicates how to allocate the target capacity across the Spot pools specified by the Spot Fleet request.
* The default is lowestPrice
.
* @see SpotAllocationStrategy
*/
public void setAllocationStrategy(String allocationStrategy) {
this.allocationStrategy = allocationStrategy;
}
/**
*
* Indicates how to allocate the target capacity across the Spot pools specified by the Spot Fleet request. The
* default is lowestPrice
.
*
*
* @return Indicates how to allocate the target capacity across the Spot pools specified by the Spot Fleet request.
* The default is lowestPrice
.
* @see SpotAllocationStrategy
*/
public String getAllocationStrategy() {
return this.allocationStrategy;
}
/**
*
* Indicates how to allocate the target capacity across the Spot pools specified by the Spot Fleet request. The
* default is lowestPrice
.
*
*
* @param allocationStrategy
* Indicates how to allocate the target capacity across the Spot pools specified by the Spot Fleet request.
* The default is lowestPrice
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SpotAllocationStrategy
*/
public SpotOptionsRequest withAllocationStrategy(String allocationStrategy) {
setAllocationStrategy(allocationStrategy);
return this;
}
/**
*
* Indicates how to allocate the target capacity across the Spot pools specified by the Spot Fleet request. The
* default is lowestPrice
.
*
*
* @param allocationStrategy
* Indicates how to allocate the target capacity across the Spot pools specified by the Spot Fleet request.
* The default is lowestPrice
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SpotAllocationStrategy
*/
public SpotOptionsRequest withAllocationStrategy(SpotAllocationStrategy allocationStrategy) {
this.allocationStrategy = allocationStrategy.toString();
return this;
}
/**
*
* The behavior when a Spot Instance is interrupted. The default is terminate
.
*
*
* @param instanceInterruptionBehavior
* The behavior when a Spot Instance is interrupted. The default is terminate
.
* @see SpotInstanceInterruptionBehavior
*/
public void setInstanceInterruptionBehavior(String instanceInterruptionBehavior) {
this.instanceInterruptionBehavior = instanceInterruptionBehavior;
}
/**
*
* The behavior when a Spot Instance is interrupted. The default is terminate
.
*
*
* @return The behavior when a Spot Instance is interrupted. The default is terminate
.
* @see SpotInstanceInterruptionBehavior
*/
public String getInstanceInterruptionBehavior() {
return this.instanceInterruptionBehavior;
}
/**
*
* The behavior when a Spot Instance is interrupted. The default is terminate
.
*
*
* @param instanceInterruptionBehavior
* The behavior when a Spot Instance is interrupted. The default is terminate
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SpotInstanceInterruptionBehavior
*/
public SpotOptionsRequest withInstanceInterruptionBehavior(String instanceInterruptionBehavior) {
setInstanceInterruptionBehavior(instanceInterruptionBehavior);
return this;
}
/**
*
* The behavior when a Spot Instance is interrupted. The default is terminate
.
*
*
* @param instanceInterruptionBehavior
* The behavior when a Spot Instance is interrupted. The default is terminate
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SpotInstanceInterruptionBehavior
*/
public SpotOptionsRequest withInstanceInterruptionBehavior(SpotInstanceInterruptionBehavior instanceInterruptionBehavior) {
this.instanceInterruptionBehavior = instanceInterruptionBehavior.toString();
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getAllocationStrategy() != null)
sb.append("AllocationStrategy: ").append(getAllocationStrategy()).append(",");
if (getInstanceInterruptionBehavior() != null)
sb.append("InstanceInterruptionBehavior: ").append(getInstanceInterruptionBehavior());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof SpotOptionsRequest == false)
return false;
SpotOptionsRequest other = (SpotOptionsRequest) obj;
if (other.getAllocationStrategy() == null ^ this.getAllocationStrategy() == null)
return false;
if (other.getAllocationStrategy() != null && other.getAllocationStrategy().equals(this.getAllocationStrategy()) == false)
return false;
if (other.getInstanceInterruptionBehavior() == null ^ this.getInstanceInterruptionBehavior() == null)
return false;
if (other.getInstanceInterruptionBehavior() != null && other.getInstanceInterruptionBehavior().equals(this.getInstanceInterruptionBehavior()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAllocationStrategy() == null) ? 0 : getAllocationStrategy().hashCode());
hashCode = prime * hashCode + ((getInstanceInterruptionBehavior() == null) ? 0 : getInstanceInterruptionBehavior().hashCode());
return hashCode;
}
@Override
public SpotOptionsRequest clone() {
try {
return (SpotOptionsRequest) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}