com.amazonaws.services.ec2.model.OnDemandOptions Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
* Copyright 2019-2024 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 On-Demand Instances in an EC2 Fleet.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class OnDemandOptions implements Serializable, Cloneable {
/**
*
* The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.
*
*
* lowest-price
- EC2 Fleet uses price to determine the order, launching the lowest price first.
*
*
* prioritized
- EC2 Fleet uses the priority that you assigned to each launch template override,
* launching the highest priority first.
*
*
* Default: lowest-price
*
*/
private String allocationStrategy;
/**
*
* The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.
*
*
* Supported only for fleets of type instant
.
*
*/
private CapacityReservationOptions capacityReservationOptions;
/**
*
* Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.
*
*
* Supported only for fleets of type instant
.
*
*/
private Boolean singleInstanceType;
/**
*
* Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.
*
*
* Supported only for fleets of type instant
.
*
*/
private Boolean singleAvailabilityZone;
/**
*
* The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached, no
* instances are launched.
*
*
* Constraints: Maximum value of 1000
. Supported only for fleets of type instant
.
*
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*
*/
private Integer minTargetCapacity;
/**
*
* The maximum amount per hour for On-Demand Instances that you're willing to pay.
*
*
*
* If your fleet includes T instances that are configured as unlimited
, and if their average CPU usage
* exceeds the baseline utilization, you will incur a charge for surplus credits. The maxTotalPrice
* does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what
* you specified for maxTotalPrice
. For more information, see Surplus credits can incur charges in the Amazon EC2 User Guide.
*
*
*/
private String maxTotalPrice;
/**
*
* The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.
*
*
* lowest-price
- EC2 Fleet uses price to determine the order, launching the lowest price first.
*
*
* prioritized
- EC2 Fleet uses the priority that you assigned to each launch template override,
* launching the highest priority first.
*
*
* Default: lowest-price
*
*
* @param allocationStrategy
* The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand
* capacity.
*
* lowest-price
- EC2 Fleet uses price to determine the order, launching the lowest price first.
*
*
* prioritized
- EC2 Fleet uses the priority that you assigned to each launch template override,
* launching the highest priority first.
*
*
* Default: lowest-price
* @see FleetOnDemandAllocationStrategy
*/
public void setAllocationStrategy(String allocationStrategy) {
this.allocationStrategy = allocationStrategy;
}
/**
*
* The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.
*
*
* lowest-price
- EC2 Fleet uses price to determine the order, launching the lowest price first.
*
*
* prioritized
- EC2 Fleet uses the priority that you assigned to each launch template override,
* launching the highest priority first.
*
*
* Default: lowest-price
*
*
* @return The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand
* capacity.
*
* lowest-price
- EC2 Fleet uses price to determine the order, launching the lowest price
* first.
*
*
* prioritized
- EC2 Fleet uses the priority that you assigned to each launch template
* override, launching the highest priority first.
*
*
* Default: lowest-price
* @see FleetOnDemandAllocationStrategy
*/
public String getAllocationStrategy() {
return this.allocationStrategy;
}
/**
*
* The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.
*
*
* lowest-price
- EC2 Fleet uses price to determine the order, launching the lowest price first.
*
*
* prioritized
- EC2 Fleet uses the priority that you assigned to each launch template override,
* launching the highest priority first.
*
*
* Default: lowest-price
*
*
* @param allocationStrategy
* The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand
* capacity.
*
* lowest-price
- EC2 Fleet uses price to determine the order, launching the lowest price first.
*
*
* prioritized
- EC2 Fleet uses the priority that you assigned to each launch template override,
* launching the highest priority first.
*
*
* Default: lowest-price
* @return Returns a reference to this object so that method calls can be chained together.
* @see FleetOnDemandAllocationStrategy
*/
public OnDemandOptions withAllocationStrategy(String allocationStrategy) {
setAllocationStrategy(allocationStrategy);
return this;
}
/**
*
* The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.
*
*
* lowest-price
- EC2 Fleet uses price to determine the order, launching the lowest price first.
*
*
* prioritized
- EC2 Fleet uses the priority that you assigned to each launch template override,
* launching the highest priority first.
*
*
* Default: lowest-price
*
*
* @param allocationStrategy
* The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand
* capacity.
*
* lowest-price
- EC2 Fleet uses price to determine the order, launching the lowest price first.
*
*
* prioritized
- EC2 Fleet uses the priority that you assigned to each launch template override,
* launching the highest priority first.
*
*
* Default: lowest-price
* @return Returns a reference to this object so that method calls can be chained together.
* @see FleetOnDemandAllocationStrategy
*/
public OnDemandOptions withAllocationStrategy(FleetOnDemandAllocationStrategy allocationStrategy) {
this.allocationStrategy = allocationStrategy.toString();
return this;
}
/**
*
* The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.
*
*
* Supported only for fleets of type instant
.
*
*
* @param capacityReservationOptions
* The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.
*
* Supported only for fleets of type instant
.
*/
public void setCapacityReservationOptions(CapacityReservationOptions capacityReservationOptions) {
this.capacityReservationOptions = capacityReservationOptions;
}
/**
*
* The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.
*
*
* Supported only for fleets of type instant
.
*
*
* @return The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.
*
* Supported only for fleets of type instant
.
*/
public CapacityReservationOptions getCapacityReservationOptions() {
return this.capacityReservationOptions;
}
/**
*
* The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.
*
*
* Supported only for fleets of type instant
.
*
*
* @param capacityReservationOptions
* The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.
*
* Supported only for fleets of type instant
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public OnDemandOptions withCapacityReservationOptions(CapacityReservationOptions capacityReservationOptions) {
setCapacityReservationOptions(capacityReservationOptions);
return this;
}
/**
*
* Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.
*
*
* Supported only for fleets of type instant
.
*
*
* @param singleInstanceType
* Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.
*
* Supported only for fleets of type instant
.
*/
public void setSingleInstanceType(Boolean singleInstanceType) {
this.singleInstanceType = singleInstanceType;
}
/**
*
* Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.
*
*
* Supported only for fleets of type instant
.
*
*
* @return Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.
*
* Supported only for fleets of type instant
.
*/
public Boolean getSingleInstanceType() {
return this.singleInstanceType;
}
/**
*
* Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.
*
*
* Supported only for fleets of type instant
.
*
*
* @param singleInstanceType
* Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.
*
* Supported only for fleets of type instant
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public OnDemandOptions withSingleInstanceType(Boolean singleInstanceType) {
setSingleInstanceType(singleInstanceType);
return this;
}
/**
*
* Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.
*
*
* Supported only for fleets of type instant
.
*
*
* @return Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.
*
* Supported only for fleets of type instant
.
*/
public Boolean isSingleInstanceType() {
return this.singleInstanceType;
}
/**
*
* Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.
*
*
* Supported only for fleets of type instant
.
*
*
* @param singleAvailabilityZone
* Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.
*
* Supported only for fleets of type instant
.
*/
public void setSingleAvailabilityZone(Boolean singleAvailabilityZone) {
this.singleAvailabilityZone = singleAvailabilityZone;
}
/**
*
* Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.
*
*
* Supported only for fleets of type instant
.
*
*
* @return Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.
*
* Supported only for fleets of type instant
.
*/
public Boolean getSingleAvailabilityZone() {
return this.singleAvailabilityZone;
}
/**
*
* Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.
*
*
* Supported only for fleets of type instant
.
*
*
* @param singleAvailabilityZone
* Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.
*
* Supported only for fleets of type instant
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public OnDemandOptions withSingleAvailabilityZone(Boolean singleAvailabilityZone) {
setSingleAvailabilityZone(singleAvailabilityZone);
return this;
}
/**
*
* Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.
*
*
* Supported only for fleets of type instant
.
*
*
* @return Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.
*
* Supported only for fleets of type instant
.
*/
public Boolean isSingleAvailabilityZone() {
return this.singleAvailabilityZone;
}
/**
*
* The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached, no
* instances are launched.
*
*
* Constraints: Maximum value of 1000
. Supported only for fleets of type instant
.
*
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*
*
* @param minTargetCapacity
* The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached,
* no instances are launched.
*
* Constraints: Maximum value of 1000
. Supported only for fleets of type instant
.
*
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*/
public void setMinTargetCapacity(Integer minTargetCapacity) {
this.minTargetCapacity = minTargetCapacity;
}
/**
*
* The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached, no
* instances are launched.
*
*
* Constraints: Maximum value of 1000
. Supported only for fleets of type instant
.
*
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*
*
* @return The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached,
* no instances are launched.
*
* Constraints: Maximum value of 1000
. Supported only for fleets of type instant
.
*
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*/
public Integer getMinTargetCapacity() {
return this.minTargetCapacity;
}
/**
*
* The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached, no
* instances are launched.
*
*
* Constraints: Maximum value of 1000
. Supported only for fleets of type instant
.
*
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*
*
* @param minTargetCapacity
* The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached,
* no instances are launched.
*
* Constraints: Maximum value of 1000
. Supported only for fleets of type instant
.
*
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
* @return Returns a reference to this object so that method calls can be chained together.
*/
public OnDemandOptions withMinTargetCapacity(Integer minTargetCapacity) {
setMinTargetCapacity(minTargetCapacity);
return this;
}
/**
*
* The maximum amount per hour for On-Demand Instances that you're willing to pay.
*
*
*
* If your fleet includes T instances that are configured as unlimited
, and if their average CPU usage
* exceeds the baseline utilization, you will incur a charge for surplus credits. The maxTotalPrice
* does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what
* you specified for maxTotalPrice
. For more information, see Surplus credits can incur charges in the Amazon EC2 User Guide.
*
*
*
* @param maxTotalPrice
* The maximum amount per hour for On-Demand Instances that you're willing to pay.
*
* If your fleet includes T instances that are configured as unlimited
, and if their average CPU
* usage exceeds the baseline utilization, you will incur a charge for surplus credits. The
* maxTotalPrice
does not account for surplus credits, and, if you use surplus credits, your
* final cost might be higher than what you specified for maxTotalPrice
. For more information,
* see Surplus credits can incur charges in the Amazon EC2 User Guide.
*
*/
public void setMaxTotalPrice(String maxTotalPrice) {
this.maxTotalPrice = maxTotalPrice;
}
/**
*
* The maximum amount per hour for On-Demand Instances that you're willing to pay.
*
*
*
* If your fleet includes T instances that are configured as unlimited
, and if their average CPU usage
* exceeds the baseline utilization, you will incur a charge for surplus credits. The maxTotalPrice
* does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what
* you specified for maxTotalPrice
. For more information, see Surplus credits can incur charges in the Amazon EC2 User Guide.
*
*
*
* @return The maximum amount per hour for On-Demand Instances that you're willing to pay.
*
* If your fleet includes T instances that are configured as unlimited
, and if their average
* CPU usage exceeds the baseline utilization, you will incur a charge for surplus credits. The
* maxTotalPrice
does not account for surplus credits, and, if you use surplus credits, your
* final cost might be higher than what you specified for maxTotalPrice
. For more information,
* see Surplus credits can incur charges in the Amazon EC2 User Guide.
*
*/
public String getMaxTotalPrice() {
return this.maxTotalPrice;
}
/**
*
* The maximum amount per hour for On-Demand Instances that you're willing to pay.
*
*
*
* If your fleet includes T instances that are configured as unlimited
, and if their average CPU usage
* exceeds the baseline utilization, you will incur a charge for surplus credits. The maxTotalPrice
* does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what
* you specified for maxTotalPrice
. For more information, see Surplus credits can incur charges in the Amazon EC2 User Guide.
*
*
*
* @param maxTotalPrice
* The maximum amount per hour for On-Demand Instances that you're willing to pay.
*
* If your fleet includes T instances that are configured as unlimited
, and if their average CPU
* usage exceeds the baseline utilization, you will incur a charge for surplus credits. The
* maxTotalPrice
does not account for surplus credits, and, if you use surplus credits, your
* final cost might be higher than what you specified for maxTotalPrice
. For more information,
* see Surplus credits can incur charges in the Amazon EC2 User Guide.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public OnDemandOptions 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 (getCapacityReservationOptions() != null)
sb.append("CapacityReservationOptions: ").append(getCapacityReservationOptions()).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 OnDemandOptions == false)
return false;
OnDemandOptions other = (OnDemandOptions) obj;
if (other.getAllocationStrategy() == null ^ this.getAllocationStrategy() == null)
return false;
if (other.getAllocationStrategy() != null && other.getAllocationStrategy().equals(this.getAllocationStrategy()) == false)
return false;
if (other.getCapacityReservationOptions() == null ^ this.getCapacityReservationOptions() == null)
return false;
if (other.getCapacityReservationOptions() != null && other.getCapacityReservationOptions().equals(this.getCapacityReservationOptions()) == 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 + ((getCapacityReservationOptions() == null) ? 0 : getCapacityReservationOptions().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 OnDemandOptions clone() {
try {
return (OnDemandOptions) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}