All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.ec2.model.SpotOptions Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with Amazon EC2 Service

There is a newer version: 1.12.765
Show newest version
/*
 * Copyright 2014-2019 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. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class SpotOptions implements Serializable, Cloneable { /** *

* Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the EC2 * Fleet. *

*

* If the allocation strategy is lowestPrice, EC2 Fleet launches instances from the Spot Instance pools * with the lowest price. This is the default allocation strategy. *

*

* If the allocation strategy is diversified, EC2 Fleet launches instances from all the Spot Instance * pools that you specify. *

*

* If the allocation strategy is capacityOptimized, EC2 Fleet launches instances from Spot Instance * pools with optimal capacity for the number of instances that are launching. *

*/ private String allocationStrategy; /** *

* The behavior when a Spot Instance is interrupted. The default is terminate. *

*/ private String instanceInterruptionBehavior; /** *

* The number of Spot pools across which to allocate your target Spot capacity. Valid only when * AllocationStrategy is set to lowestPrice. EC2 Fleet selects the cheapest Spot pools and * evenly allocates your target Spot capacity across the number of Spot pools that you specify. *

*/ private Integer instancePoolsToUseCount; /** *

* Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. *

*/ private Boolean singleInstanceType; /** *

* Indicates that the fleet launches all Spot Instances into a single Availability Zone. *

*/ private Boolean singleAvailabilityZone; /** *

* The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not reached, the * fleet launches no instances. *

*/ private Integer minTargetCapacity; /** *

* The maximum amount per hour for Spot Instances that you're willing to pay. *

*/ private String maxTotalPrice; /** *

* Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the EC2 * Fleet. *

*

* If the allocation strategy is lowestPrice, EC2 Fleet launches instances from the Spot Instance pools * with the lowest price. This is the default allocation strategy. *

*

* If the allocation strategy is diversified, EC2 Fleet launches instances from all the Spot Instance * pools that you specify. *

*

* If the allocation strategy is capacityOptimized, EC2 Fleet launches instances from Spot Instance * pools with optimal capacity for the number of instances that are launching. *

* * @param allocationStrategy * Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by * the EC2 Fleet.

*

* If the allocation strategy is lowestPrice, EC2 Fleet launches instances from the Spot * Instance pools with the lowest price. This is the default allocation strategy. *

*

* If the allocation strategy is diversified, EC2 Fleet launches instances from all the Spot * Instance pools that you specify. *

*

* If the allocation strategy is capacityOptimized, EC2 Fleet launches instances from Spot * Instance pools with optimal capacity for the number of instances that are launching. * @see SpotAllocationStrategy */ public void setAllocationStrategy(String allocationStrategy) { this.allocationStrategy = allocationStrategy; } /** *

* Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the EC2 * Fleet. *

*

* If the allocation strategy is lowestPrice, EC2 Fleet launches instances from the Spot Instance pools * with the lowest price. This is the default allocation strategy. *

*

* If the allocation strategy is diversified, EC2 Fleet launches instances from all the Spot Instance * pools that you specify. *

*

* If the allocation strategy is capacityOptimized, EC2 Fleet launches instances from Spot Instance * pools with optimal capacity for the number of instances that are launching. *

* * @return Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by * the EC2 Fleet.

*

* If the allocation strategy is lowestPrice, EC2 Fleet launches instances from the Spot * Instance pools with the lowest price. This is the default allocation strategy. *

*

* If the allocation strategy is diversified, EC2 Fleet launches instances from all the Spot * Instance pools that you specify. *

*

* If the allocation strategy is capacityOptimized, EC2 Fleet launches instances from Spot * Instance pools with optimal capacity for the number of instances that are launching. * @see SpotAllocationStrategy */ public String getAllocationStrategy() { return this.allocationStrategy; } /** *

* Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the EC2 * Fleet. *

*

* If the allocation strategy is lowestPrice, EC2 Fleet launches instances from the Spot Instance pools * with the lowest price. This is the default allocation strategy. *

*

* If the allocation strategy is diversified, EC2 Fleet launches instances from all the Spot Instance * pools that you specify. *

*

* If the allocation strategy is capacityOptimized, EC2 Fleet launches instances from Spot Instance * pools with optimal capacity for the number of instances that are launching. *

* * @param allocationStrategy * Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by * the EC2 Fleet.

*

* If the allocation strategy is lowestPrice, EC2 Fleet launches instances from the Spot * Instance pools with the lowest price. This is the default allocation strategy. *

*

* If the allocation strategy is diversified, EC2 Fleet launches instances from all the Spot * Instance pools that you specify. *

*

* If the allocation strategy is capacityOptimized, EC2 Fleet launches instances from Spot * Instance pools with optimal capacity for the number of instances that are launching. * @return Returns a reference to this object so that method calls can be chained together. * @see SpotAllocationStrategy */ public SpotOptions withAllocationStrategy(String allocationStrategy) { setAllocationStrategy(allocationStrategy); return this; } /** *

* Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the EC2 * Fleet. *

*

* If the allocation strategy is lowestPrice, EC2 Fleet launches instances from the Spot Instance pools * with the lowest price. This is the default allocation strategy. *

*

* If the allocation strategy is diversified, EC2 Fleet launches instances from all the Spot Instance * pools that you specify. *

*

* If the allocation strategy is capacityOptimized, EC2 Fleet launches instances from Spot Instance * pools with optimal capacity for the number of instances that are launching. *

* * @param allocationStrategy * Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by * the EC2 Fleet.

*

* If the allocation strategy is lowestPrice, EC2 Fleet launches instances from the Spot * Instance pools with the lowest price. This is the default allocation strategy. *

*

* If the allocation strategy is diversified, EC2 Fleet launches instances from all the Spot * Instance pools that you specify. *

*

* If the allocation strategy is capacityOptimized, EC2 Fleet launches instances from Spot * Instance pools with optimal capacity for the number of instances that are launching. * @return Returns a reference to this object so that method calls can be chained together. * @see SpotAllocationStrategy */ public SpotOptions 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 SpotOptions 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 SpotOptions withInstanceInterruptionBehavior(SpotInstanceInterruptionBehavior instanceInterruptionBehavior) { this.instanceInterruptionBehavior = instanceInterruptionBehavior.toString(); return this; } /** *

* The number of Spot pools across which to allocate your target Spot capacity. Valid only when * AllocationStrategy is set to lowestPrice. EC2 Fleet selects the cheapest Spot pools and * evenly allocates your target Spot capacity across the number of Spot pools that you specify. *

* * @param instancePoolsToUseCount * The number of Spot pools across which to allocate your target Spot capacity. Valid only when * AllocationStrategy is set to lowestPrice. EC2 Fleet selects the cheapest Spot pools * and evenly allocates your target Spot capacity across the number of Spot pools that you specify. */ public void setInstancePoolsToUseCount(Integer instancePoolsToUseCount) { this.instancePoolsToUseCount = instancePoolsToUseCount; } /** *

* The number of Spot pools across which to allocate your target Spot capacity. Valid only when * AllocationStrategy is set to lowestPrice. EC2 Fleet selects the cheapest Spot pools and * evenly allocates your target Spot capacity across the number of Spot pools that you specify. *

* * @return The number of Spot pools across which to allocate your target Spot capacity. Valid only when * AllocationStrategy is set to lowestPrice. EC2 Fleet selects the cheapest Spot pools * and evenly allocates your target Spot capacity across the number of Spot pools that you specify. */ public Integer getInstancePoolsToUseCount() { return this.instancePoolsToUseCount; } /** *

* The number of Spot pools across which to allocate your target Spot capacity. Valid only when * AllocationStrategy is set to lowestPrice. EC2 Fleet selects the cheapest Spot pools and * evenly allocates your target Spot capacity across the number of Spot pools that you specify. *

* * @param instancePoolsToUseCount * The number of Spot pools across which to allocate your target Spot capacity. Valid only when * AllocationStrategy is set to lowestPrice. EC2 Fleet selects the cheapest Spot pools * and evenly allocates your target Spot capacity across the number of Spot pools that you specify. * @return Returns a reference to this object so that method calls can be chained together. */ public SpotOptions withInstancePoolsToUseCount(Integer instancePoolsToUseCount) { setInstancePoolsToUseCount(instancePoolsToUseCount); return this; } /** *

* Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. *

* * @param singleInstanceType * Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. */ public void setSingleInstanceType(Boolean singleInstanceType) { this.singleInstanceType = singleInstanceType; } /** *

* Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. *

* * @return Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. */ public Boolean getSingleInstanceType() { return this.singleInstanceType; } /** *

* Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. *

* * @param singleInstanceType * Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. * @return Returns a reference to this object so that method calls can be chained together. */ public SpotOptions withSingleInstanceType(Boolean singleInstanceType) { setSingleInstanceType(singleInstanceType); return this; } /** *

* Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. *

* * @return Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. */ public Boolean isSingleInstanceType() { return this.singleInstanceType; } /** *

* Indicates that the fleet launches all Spot Instances into a single Availability Zone. *

* * @param singleAvailabilityZone * Indicates that the fleet launches all Spot Instances into a single Availability Zone. */ public void setSingleAvailabilityZone(Boolean singleAvailabilityZone) { this.singleAvailabilityZone = singleAvailabilityZone; } /** *

* Indicates that the fleet launches all Spot Instances into a single Availability Zone. *

* * @return Indicates that the fleet launches all Spot Instances into a single Availability Zone. */ public Boolean getSingleAvailabilityZone() { return this.singleAvailabilityZone; } /** *

* Indicates that the fleet launches all Spot Instances into a single Availability Zone. *

* * @param singleAvailabilityZone * Indicates that the fleet launches all Spot Instances into a single Availability Zone. * @return Returns a reference to this object so that method calls can be chained together. */ public SpotOptions withSingleAvailabilityZone(Boolean singleAvailabilityZone) { setSingleAvailabilityZone(singleAvailabilityZone); return this; } /** *

* Indicates that the fleet launches all Spot Instances into a single Availability Zone. *

* * @return Indicates that the fleet launches all Spot Instances into a single Availability Zone. */ public Boolean isSingleAvailabilityZone() { return this.singleAvailabilityZone; } /** *

* The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not reached, the * fleet launches no instances. *

* * @param minTargetCapacity * The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not * reached, the fleet launches no instances. */ public void setMinTargetCapacity(Integer minTargetCapacity) { this.minTargetCapacity = minTargetCapacity; } /** *

* The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not reached, the * fleet launches no instances. *

* * @return The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not * reached, the fleet launches no instances. */ public Integer getMinTargetCapacity() { return this.minTargetCapacity; } /** *

* The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not reached, the * fleet launches no instances. *

* * @param minTargetCapacity * The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not * reached, the fleet launches no instances. * @return Returns a reference to this object so that method calls can be chained together. */ public SpotOptions withMinTargetCapacity(Integer minTargetCapacity) { setMinTargetCapacity(minTargetCapacity); return this; } /** *

* The maximum amount per hour for Spot Instances that you're willing to pay. *

* * @param maxTotalPrice * The maximum amount per hour for Spot Instances that you're willing to pay. */ public void setMaxTotalPrice(String maxTotalPrice) { this.maxTotalPrice = maxTotalPrice; } /** *

* The maximum amount per hour for Spot Instances that you're willing to pay. *

* * @return The maximum amount per hour for Spot Instances that you're willing to pay. */ public String getMaxTotalPrice() { return this.maxTotalPrice; } /** *

* The maximum amount per hour for Spot Instances that you're willing to pay. *

* * @param maxTotalPrice * The maximum amount per hour for Spot Instances that you're willing to pay. * @return Returns a reference to this object so that method calls can be chained together. */ public SpotOptions withMaxTotalPrice(String maxTotalPrice) { setMaxTotalPrice(maxTotalPrice); 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 (getAllocationStrategy() != null) sb.append("AllocationStrategy: ").append(getAllocationStrategy()).append(","); if (getInstanceInterruptionBehavior() != null) sb.append("InstanceInterruptionBehavior: ").append(getInstanceInterruptionBehavior()).append(","); if (getInstancePoolsToUseCount() != null) sb.append("InstancePoolsToUseCount: ").append(getInstancePoolsToUseCount()).append(","); if (getSingleInstanceType() != null) sb.append("SingleInstanceType: ").append(getSingleInstanceType()).append(","); if (getSingleAvailabilityZone() != null) sb.append("SingleAvailabilityZone: ").append(getSingleAvailabilityZone()).append(","); if (getMinTargetCapacity() != null) sb.append("MinTargetCapacity: ").append(getMinTargetCapacity()).append(","); if (getMaxTotalPrice() != null) sb.append("MaxTotalPrice: ").append(getMaxTotalPrice()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SpotOptions == false) return false; SpotOptions other = (SpotOptions) 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; if (other.getInstancePoolsToUseCount() == null ^ this.getInstancePoolsToUseCount() == null) return false; if (other.getInstancePoolsToUseCount() != null && other.getInstancePoolsToUseCount().equals(this.getInstancePoolsToUseCount()) == false) return false; if (other.getSingleInstanceType() == null ^ this.getSingleInstanceType() == null) return false; if (other.getSingleInstanceType() != null && other.getSingleInstanceType().equals(this.getSingleInstanceType()) == false) return false; if (other.getSingleAvailabilityZone() == null ^ this.getSingleAvailabilityZone() == null) return false; if (other.getSingleAvailabilityZone() != null && other.getSingleAvailabilityZone().equals(this.getSingleAvailabilityZone()) == false) return false; if (other.getMinTargetCapacity() == null ^ this.getMinTargetCapacity() == null) return false; if (other.getMinTargetCapacity() != null && other.getMinTargetCapacity().equals(this.getMinTargetCapacity()) == false) return false; if (other.getMaxTotalPrice() == null ^ this.getMaxTotalPrice() == null) return false; if (other.getMaxTotalPrice() != null && other.getMaxTotalPrice().equals(this.getMaxTotalPrice()) == 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()); hashCode = prime * hashCode + ((getInstancePoolsToUseCount() == null) ? 0 : getInstancePoolsToUseCount().hashCode()); hashCode = prime * hashCode + ((getSingleInstanceType() == null) ? 0 : getSingleInstanceType().hashCode()); hashCode = prime * hashCode + ((getSingleAvailabilityZone() == null) ? 0 : getSingleAvailabilityZone().hashCode()); hashCode = prime * hashCode + ((getMinTargetCapacity() == null) ? 0 : getMinTargetCapacity().hashCode()); hashCode = prime * hashCode + ((getMaxTotalPrice() == null) ? 0 : getMaxTotalPrice().hashCode()); return hashCode; } @Override public SpotOptions clone() { try { return (SpotOptions) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy