com.amazonaws.services.ec2.model.LaunchTemplateOverrides 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 overrides for a launch template.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class LaunchTemplateOverrides implements Serializable, Cloneable {
/**
*
* The instance type.
*
*/
private String instanceType;
/**
*
* The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this
* parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the
* current Spot price.
*
*
*
* If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify
* this parameter.
*
*
*/
private String spotPrice;
/**
*
* The ID of the subnet in which to launch the instances.
*
*/
private String subnetId;
/**
*
* The Availability Zone in which to launch the instances.
*
*/
private String availabilityZone;
/**
*
* The number of units provided by the specified instance type. These are the same units that you chose to set the
* target capacity in terms of instances, or a performance characteristic such as vCPUs, memory, or I/O.
*
*
* If the target capacity divided by this value is not a whole number, Amazon EC2 rounds the number of instances to
* the next whole number. If this value is not specified, the default is 1.
*
*
*
* When specifying weights, the price used in the lowestPrice
and priceCapacityOptimized
* allocation strategies is per unit hour (where the instance price is divided by the specified weight).
* However, if all the specified weights are above the requested TargetCapacity
, resulting in only 1
* instance being launched, the price used is per instance hour.
*
*
*/
private Double weightedCapacity;
/**
*
* The priority for the launch template override. The highest priority is launched first.
*
*
* If OnDemandAllocationStrategy
is set to prioritized
, Spot Fleet uses priority to
* determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacityOptimizedPrioritized
, Spot Fleet uses
* priority on a best-effort basis to determine which launch template override to use in fulfilling Spot capacity,
* but optimizes for capacity first.
*
*
* Valid values are whole numbers starting at 0
. The lower the number, the higher the priority. If no
* number is set, the launch template override has the lowest priority. You can set the same priority for different
* launch template overrides.
*
*/
private Double priority;
/**
*
* The instance requirements. When you specify instance requirements, Amazon EC2 will identify instance types with
* the provided requirements, and then use your On-Demand and Spot allocation strategies to launch instances from
* these instance types, in the same way as when you specify a list of instance types.
*
*
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*
*/
private InstanceRequirements instanceRequirements;
/**
*
* The instance type.
*
*
* @param instanceType
* The instance type.
* @see InstanceType
*/
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
/**
*
* The instance type.
*
*
* @return The instance type.
* @see InstanceType
*/
public String getInstanceType() {
return this.instanceType;
}
/**
*
* The instance type.
*
*
* @param instanceType
* The instance type.
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceType
*/
public LaunchTemplateOverrides withInstanceType(String instanceType) {
setInstanceType(instanceType);
return this;
}
/**
*
* The instance type.
*
*
* @param instanceType
* The instance type.
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceType
*/
public LaunchTemplateOverrides withInstanceType(InstanceType instanceType) {
this.instanceType = instanceType.toString();
return this;
}
/**
*
* The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this
* parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the
* current Spot price.
*
*
*
* If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify
* this parameter.
*
*
*
* @param spotPrice
* The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using
* this parameter because it can lead to increased interruptions. If you do not specify this parameter, you
* will pay the current Spot price.
*
* If you specify a maximum price, your instances will be interrupted more frequently than if you do not
* specify this parameter.
*
*/
public void setSpotPrice(String spotPrice) {
this.spotPrice = spotPrice;
}
/**
*
* The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this
* parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the
* current Spot price.
*
*
*
* If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify
* this parameter.
*
*
*
* @return The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend
* using this parameter because it can lead to increased interruptions. If you do not specify this
* parameter, you will pay the current Spot price.
*
* If you specify a maximum price, your instances will be interrupted more frequently than if you do not
* specify this parameter.
*
*/
public String getSpotPrice() {
return this.spotPrice;
}
/**
*
* The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this
* parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the
* current Spot price.
*
*
*
* If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify
* this parameter.
*
*
*
* @param spotPrice
* The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using
* this parameter because it can lead to increased interruptions. If you do not specify this parameter, you
* will pay the current Spot price.
*
* If you specify a maximum price, your instances will be interrupted more frequently than if you do not
* specify this parameter.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LaunchTemplateOverrides withSpotPrice(String spotPrice) {
setSpotPrice(spotPrice);
return this;
}
/**
*
* The ID of the subnet in which to launch the instances.
*
*
* @param subnetId
* The ID of the subnet in which to launch the instances.
*/
public void setSubnetId(String subnetId) {
this.subnetId = subnetId;
}
/**
*
* The ID of the subnet in which to launch the instances.
*
*
* @return The ID of the subnet in which to launch the instances.
*/
public String getSubnetId() {
return this.subnetId;
}
/**
*
* The ID of the subnet in which to launch the instances.
*
*
* @param subnetId
* The ID of the subnet in which to launch the instances.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LaunchTemplateOverrides withSubnetId(String subnetId) {
setSubnetId(subnetId);
return this;
}
/**
*
* The Availability Zone in which to launch the instances.
*
*
* @param availabilityZone
* The Availability Zone in which to launch the instances.
*/
public void setAvailabilityZone(String availabilityZone) {
this.availabilityZone = availabilityZone;
}
/**
*
* The Availability Zone in which to launch the instances.
*
*
* @return The Availability Zone in which to launch the instances.
*/
public String getAvailabilityZone() {
return this.availabilityZone;
}
/**
*
* The Availability Zone in which to launch the instances.
*
*
* @param availabilityZone
* The Availability Zone in which to launch the instances.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LaunchTemplateOverrides withAvailabilityZone(String availabilityZone) {
setAvailabilityZone(availabilityZone);
return this;
}
/**
*
* The number of units provided by the specified instance type. These are the same units that you chose to set the
* target capacity in terms of instances, or a performance characteristic such as vCPUs, memory, or I/O.
*
*
* If the target capacity divided by this value is not a whole number, Amazon EC2 rounds the number of instances to
* the next whole number. If this value is not specified, the default is 1.
*
*
*
* When specifying weights, the price used in the lowestPrice
and priceCapacityOptimized
* allocation strategies is per unit hour (where the instance price is divided by the specified weight).
* However, if all the specified weights are above the requested TargetCapacity
, resulting in only 1
* instance being launched, the price used is per instance hour.
*
*
*
* @param weightedCapacity
* The number of units provided by the specified instance type. These are the same units that you chose to
* set the target capacity in terms of instances, or a performance characteristic such as vCPUs, memory, or
* I/O.
*
* If the target capacity divided by this value is not a whole number, Amazon EC2 rounds the number of
* instances to the next whole number. If this value is not specified, the default is 1.
*
*
*
* When specifying weights, the price used in the lowestPrice
and
* priceCapacityOptimized
allocation strategies is per unit hour (where the instance
* price is divided by the specified weight). However, if all the specified weights are above the requested
* TargetCapacity
, resulting in only 1 instance being launched, the price used is per
* instance hour.
*
*/
public void setWeightedCapacity(Double weightedCapacity) {
this.weightedCapacity = weightedCapacity;
}
/**
*
* The number of units provided by the specified instance type. These are the same units that you chose to set the
* target capacity in terms of instances, or a performance characteristic such as vCPUs, memory, or I/O.
*
*
* If the target capacity divided by this value is not a whole number, Amazon EC2 rounds the number of instances to
* the next whole number. If this value is not specified, the default is 1.
*
*
*
* When specifying weights, the price used in the lowestPrice
and priceCapacityOptimized
* allocation strategies is per unit hour (where the instance price is divided by the specified weight).
* However, if all the specified weights are above the requested TargetCapacity
, resulting in only 1
* instance being launched, the price used is per instance hour.
*
*
*
* @return The number of units provided by the specified instance type. These are the same units that you chose to
* set the target capacity in terms of instances, or a performance characteristic such as vCPUs, memory, or
* I/O.
*
* If the target capacity divided by this value is not a whole number, Amazon EC2 rounds the number of
* instances to the next whole number. If this value is not specified, the default is 1.
*
*
*
* When specifying weights, the price used in the lowestPrice
and
* priceCapacityOptimized
allocation strategies is per unit hour (where the instance
* price is divided by the specified weight). However, if all the specified weights are above the requested
* TargetCapacity
, resulting in only 1 instance being launched, the price used is per
* instance hour.
*
*/
public Double getWeightedCapacity() {
return this.weightedCapacity;
}
/**
*
* The number of units provided by the specified instance type. These are the same units that you chose to set the
* target capacity in terms of instances, or a performance characteristic such as vCPUs, memory, or I/O.
*
*
* If the target capacity divided by this value is not a whole number, Amazon EC2 rounds the number of instances to
* the next whole number. If this value is not specified, the default is 1.
*
*
*
* When specifying weights, the price used in the lowestPrice
and priceCapacityOptimized
* allocation strategies is per unit hour (where the instance price is divided by the specified weight).
* However, if all the specified weights are above the requested TargetCapacity
, resulting in only 1
* instance being launched, the price used is per instance hour.
*
*
*
* @param weightedCapacity
* The number of units provided by the specified instance type. These are the same units that you chose to
* set the target capacity in terms of instances, or a performance characteristic such as vCPUs, memory, or
* I/O.
*
* If the target capacity divided by this value is not a whole number, Amazon EC2 rounds the number of
* instances to the next whole number. If this value is not specified, the default is 1.
*
*
*
* When specifying weights, the price used in the lowestPrice
and
* priceCapacityOptimized
allocation strategies is per unit hour (where the instance
* price is divided by the specified weight). However, if all the specified weights are above the requested
* TargetCapacity
, resulting in only 1 instance being launched, the price used is per
* instance hour.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LaunchTemplateOverrides withWeightedCapacity(Double weightedCapacity) {
setWeightedCapacity(weightedCapacity);
return this;
}
/**
*
* The priority for the launch template override. The highest priority is launched first.
*
*
* If OnDemandAllocationStrategy
is set to prioritized
, Spot Fleet uses priority to
* determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacityOptimizedPrioritized
, Spot Fleet uses
* priority on a best-effort basis to determine which launch template override to use in fulfilling Spot capacity,
* but optimizes for capacity first.
*
*
* Valid values are whole numbers starting at 0
. The lower the number, the higher the priority. If no
* number is set, the launch template override has the lowest priority. You can set the same priority for different
* launch template overrides.
*
*
* @param priority
* The priority for the launch template override. The highest priority is launched first.
*
* If OnDemandAllocationStrategy
is set to prioritized
, Spot Fleet uses priority to
* determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacityOptimizedPrioritized
, Spot
* Fleet uses priority on a best-effort basis to determine which launch template override to use in
* fulfilling Spot capacity, but optimizes for capacity first.
*
*
* Valid values are whole numbers starting at 0
. The lower the number, the higher the priority.
* If no number is set, the launch template override has the lowest priority. You can set the same priority
* for different launch template overrides.
*/
public void setPriority(Double priority) {
this.priority = priority;
}
/**
*
* The priority for the launch template override. The highest priority is launched first.
*
*
* If OnDemandAllocationStrategy
is set to prioritized
, Spot Fleet uses priority to
* determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacityOptimizedPrioritized
, Spot Fleet uses
* priority on a best-effort basis to determine which launch template override to use in fulfilling Spot capacity,
* but optimizes for capacity first.
*
*
* Valid values are whole numbers starting at 0
. The lower the number, the higher the priority. If no
* number is set, the launch template override has the lowest priority. You can set the same priority for different
* launch template overrides.
*
*
* @return The priority for the launch template override. The highest priority is launched first.
*
* If OnDemandAllocationStrategy
is set to prioritized
, Spot Fleet uses priority
* to determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacityOptimizedPrioritized
, Spot
* Fleet uses priority on a best-effort basis to determine which launch template override to use in
* fulfilling Spot capacity, but optimizes for capacity first.
*
*
* Valid values are whole numbers starting at 0
. The lower the number, the higher the priority.
* If no number is set, the launch template override has the lowest priority. You can set the same priority
* for different launch template overrides.
*/
public Double getPriority() {
return this.priority;
}
/**
*
* The priority for the launch template override. The highest priority is launched first.
*
*
* If OnDemandAllocationStrategy
is set to prioritized
, Spot Fleet uses priority to
* determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacityOptimizedPrioritized
, Spot Fleet uses
* priority on a best-effort basis to determine which launch template override to use in fulfilling Spot capacity,
* but optimizes for capacity first.
*
*
* Valid values are whole numbers starting at 0
. The lower the number, the higher the priority. If no
* number is set, the launch template override has the lowest priority. You can set the same priority for different
* launch template overrides.
*
*
* @param priority
* The priority for the launch template override. The highest priority is launched first.
*
* If OnDemandAllocationStrategy
is set to prioritized
, Spot Fleet uses priority to
* determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacityOptimizedPrioritized
, Spot
* Fleet uses priority on a best-effort basis to determine which launch template override to use in
* fulfilling Spot capacity, but optimizes for capacity first.
*
*
* Valid values are whole numbers starting at 0
. The lower the number, the higher the priority.
* If no number is set, the launch template override has the lowest priority. You can set the same priority
* for different launch template overrides.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LaunchTemplateOverrides withPriority(Double priority) {
setPriority(priority);
return this;
}
/**
*
* The instance requirements. When you specify instance requirements, Amazon EC2 will identify instance types with
* the provided requirements, and then use your On-Demand and Spot allocation strategies to launch instances from
* these instance types, in the same way as when you specify a list of instance types.
*
*
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*
*
* @param instanceRequirements
* The instance requirements. When you specify instance requirements, Amazon EC2 will identify instance types
* with the provided requirements, and then use your On-Demand and Spot allocation strategies to launch
* instances from these instance types, in the same way as when you specify a list of instance types.
*
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*/
public void setInstanceRequirements(InstanceRequirements instanceRequirements) {
this.instanceRequirements = instanceRequirements;
}
/**
*
* The instance requirements. When you specify instance requirements, Amazon EC2 will identify instance types with
* the provided requirements, and then use your On-Demand and Spot allocation strategies to launch instances from
* these instance types, in the same way as when you specify a list of instance types.
*
*
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*
*
* @return The instance requirements. When you specify instance requirements, Amazon EC2 will identify instance
* types with the provided requirements, and then use your On-Demand and Spot allocation strategies to
* launch instances from these instance types, in the same way as when you specify a list of instance
* types.
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*/
public InstanceRequirements getInstanceRequirements() {
return this.instanceRequirements;
}
/**
*
* The instance requirements. When you specify instance requirements, Amazon EC2 will identify instance types with
* the provided requirements, and then use your On-Demand and Spot allocation strategies to launch instances from
* these instance types, in the same way as when you specify a list of instance types.
*
*
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*
*
* @param instanceRequirements
* The instance requirements. When you specify instance requirements, Amazon EC2 will identify instance types
* with the provided requirements, and then use your On-Demand and Spot allocation strategies to launch
* instances from these instance types, in the same way as when you specify a list of instance types.
*
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LaunchTemplateOverrides withInstanceRequirements(InstanceRequirements instanceRequirements) {
setInstanceRequirements(instanceRequirements);
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 (getInstanceType() != null)
sb.append("InstanceType: ").append(getInstanceType()).append(",");
if (getSpotPrice() != null)
sb.append("SpotPrice: ").append(getSpotPrice()).append(",");
if (getSubnetId() != null)
sb.append("SubnetId: ").append(getSubnetId()).append(",");
if (getAvailabilityZone() != null)
sb.append("AvailabilityZone: ").append(getAvailabilityZone()).append(",");
if (getWeightedCapacity() != null)
sb.append("WeightedCapacity: ").append(getWeightedCapacity()).append(",");
if (getPriority() != null)
sb.append("Priority: ").append(getPriority()).append(",");
if (getInstanceRequirements() != null)
sb.append("InstanceRequirements: ").append(getInstanceRequirements());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof LaunchTemplateOverrides == false)
return false;
LaunchTemplateOverrides other = (LaunchTemplateOverrides) obj;
if (other.getInstanceType() == null ^ this.getInstanceType() == null)
return false;
if (other.getInstanceType() != null && other.getInstanceType().equals(this.getInstanceType()) == false)
return false;
if (other.getSpotPrice() == null ^ this.getSpotPrice() == null)
return false;
if (other.getSpotPrice() != null && other.getSpotPrice().equals(this.getSpotPrice()) == false)
return false;
if (other.getSubnetId() == null ^ this.getSubnetId() == null)
return false;
if (other.getSubnetId() != null && other.getSubnetId().equals(this.getSubnetId()) == false)
return false;
if (other.getAvailabilityZone() == null ^ this.getAvailabilityZone() == null)
return false;
if (other.getAvailabilityZone() != null && other.getAvailabilityZone().equals(this.getAvailabilityZone()) == false)
return false;
if (other.getWeightedCapacity() == null ^ this.getWeightedCapacity() == null)
return false;
if (other.getWeightedCapacity() != null && other.getWeightedCapacity().equals(this.getWeightedCapacity()) == false)
return false;
if (other.getPriority() == null ^ this.getPriority() == null)
return false;
if (other.getPriority() != null && other.getPriority().equals(this.getPriority()) == false)
return false;
if (other.getInstanceRequirements() == null ^ this.getInstanceRequirements() == null)
return false;
if (other.getInstanceRequirements() != null && other.getInstanceRequirements().equals(this.getInstanceRequirements()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode());
hashCode = prime * hashCode + ((getSpotPrice() == null) ? 0 : getSpotPrice().hashCode());
hashCode = prime * hashCode + ((getSubnetId() == null) ? 0 : getSubnetId().hashCode());
hashCode = prime * hashCode + ((getAvailabilityZone() == null) ? 0 : getAvailabilityZone().hashCode());
hashCode = prime * hashCode + ((getWeightedCapacity() == null) ? 0 : getWeightedCapacity().hashCode());
hashCode = prime * hashCode + ((getPriority() == null) ? 0 : getPriority().hashCode());
hashCode = prime * hashCode + ((getInstanceRequirements() == null) ? 0 : getInstanceRequirements().hashCode());
return hashCode;
}
@Override
public LaunchTemplateOverrides clone() {
try {
return (LaunchTemplateOverrides) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}