com.amazonaws.services.ec2.model.FleetLaunchTemplateOverrides Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
* Copyright 2018-2023 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 FleetLaunchTemplateOverrides implements Serializable, Cloneable {
/**
*
* The instance type.
*
*
* mac1.metal
is not supported as a launch template override.
*
*
*
* If you specify InstanceType
, you can't specify InstanceRequirements
.
*
*
*/
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 maxPrice;
/**
*
* 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.
*
*/
private Double weightedCapacity;
/**
*
* The priority for the launch template override. The highest priority is launched first.
*
*
* If the On-Demand AllocationStrategy
is set to prioritized
, EC2 Fleet uses priority to
* determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacity-optimized-prioritized
, EC2 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 override has the lowest priority. You can set the same priority for different launch template
* overrides.
*
*/
private Double priority;
/**
*
* The location where the instance launched, if applicable.
*
*/
private PlacementResponse placement;
/**
*
* The attributes for the instance types. When you specify instance attributes, Amazon EC2 will identify instance
* types with those attributes.
*
*
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*
*/
private InstanceRequirements instanceRequirements;
/**
*
* The ID of the AMI. An AMI is required to launch an instance. This parameter is only available for fleets of type
* instant
. For fleets of type maintain
and request
, you must specify the AMI
* ID in the launch template.
*
*/
private String imageId;
/**
*
* The instance type.
*
*
* mac1.metal
is not supported as a launch template override.
*
*
*
* If you specify InstanceType
, you can't specify InstanceRequirements
.
*
*
*
* @param instanceType
* The instance type.
*
* mac1.metal
is not supported as a launch template override.
*
*
*
* If you specify InstanceType
, you can't specify InstanceRequirements
.
*
* @see InstanceType
*/
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
/**
*
* The instance type.
*
*
* mac1.metal
is not supported as a launch template override.
*
*
*
* If you specify InstanceType
, you can't specify InstanceRequirements
.
*
*
*
* @return The instance type.
*
* mac1.metal
is not supported as a launch template override.
*
*
*
* If you specify InstanceType
, you can't specify InstanceRequirements
.
*
* @see InstanceType
*/
public String getInstanceType() {
return this.instanceType;
}
/**
*
* The instance type.
*
*
* mac1.metal
is not supported as a launch template override.
*
*
*
* If you specify InstanceType
, you can't specify InstanceRequirements
.
*
*
*
* @param instanceType
* The instance type.
*
* mac1.metal
is not supported as a launch template override.
*
*
*
* If you specify InstanceType
, you can't specify InstanceRequirements
.
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceType
*/
public FleetLaunchTemplateOverrides withInstanceType(String instanceType) {
setInstanceType(instanceType);
return this;
}
/**
*
* The instance type.
*
*
* mac1.metal
is not supported as a launch template override.
*
*
*
* If you specify InstanceType
, you can't specify InstanceRequirements
.
*
*
*
* @param instanceType
* The instance type.
*
* mac1.metal
is not supported as a launch template override.
*
*
*
* If you specify InstanceType
, you can't specify InstanceRequirements
.
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceType
*/
public FleetLaunchTemplateOverrides 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 maxPrice
* 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 setMaxPrice(String maxPrice) {
this.maxPrice = maxPrice;
}
/**
*
* 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 getMaxPrice() {
return this.maxPrice;
}
/**
*
* 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 maxPrice
* 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 FleetLaunchTemplateOverrides withMaxPrice(String maxPrice) {
setMaxPrice(maxPrice);
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 FleetLaunchTemplateOverrides 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 FleetLaunchTemplateOverrides withAvailabilityZone(String availabilityZone) {
setAvailabilityZone(availabilityZone);
return this;
}
/**
*
* The number of units provided by the specified instance type.
*
*
* @param weightedCapacity
* The number of units provided by the specified instance type.
*/
public void setWeightedCapacity(Double weightedCapacity) {
this.weightedCapacity = weightedCapacity;
}
/**
*
* The number of units provided by the specified instance type.
*
*
* @return The number of units provided by the specified instance type.
*/
public Double getWeightedCapacity() {
return this.weightedCapacity;
}
/**
*
* The number of units provided by the specified instance type.
*
*
* @param weightedCapacity
* The number of units provided by the specified instance type.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FleetLaunchTemplateOverrides withWeightedCapacity(Double weightedCapacity) {
setWeightedCapacity(weightedCapacity);
return this;
}
/**
*
* The priority for the launch template override. The highest priority is launched first.
*
*
* If the On-Demand AllocationStrategy
is set to prioritized
, EC2 Fleet uses priority to
* determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacity-optimized-prioritized
, EC2 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 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 the On-Demand AllocationStrategy
is set to prioritized
, EC2 Fleet uses
* priority to determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacity-optimized-prioritized
, EC2
* 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 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 the On-Demand AllocationStrategy
is set to prioritized
, EC2 Fleet uses priority to
* determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacity-optimized-prioritized
, EC2 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 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 the On-Demand AllocationStrategy
is set to prioritized
, EC2 Fleet uses
* priority to determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacity-optimized-prioritized
, EC2
* 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 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 the On-Demand AllocationStrategy
is set to prioritized
, EC2 Fleet uses priority to
* determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacity-optimized-prioritized
, EC2 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 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 the On-Demand AllocationStrategy
is set to prioritized
, EC2 Fleet uses
* priority to determine which launch template override to use first in fulfilling On-Demand capacity.
*
*
* If the Spot AllocationStrategy
is set to capacity-optimized-prioritized
, EC2
* 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 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 FleetLaunchTemplateOverrides withPriority(Double priority) {
setPriority(priority);
return this;
}
/**
*
* The location where the instance launched, if applicable.
*
*
* @param placement
* The location where the instance launched, if applicable.
*/
public void setPlacement(PlacementResponse placement) {
this.placement = placement;
}
/**
*
* The location where the instance launched, if applicable.
*
*
* @return The location where the instance launched, if applicable.
*/
public PlacementResponse getPlacement() {
return this.placement;
}
/**
*
* The location where the instance launched, if applicable.
*
*
* @param placement
* The location where the instance launched, if applicable.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FleetLaunchTemplateOverrides withPlacement(PlacementResponse placement) {
setPlacement(placement);
return this;
}
/**
*
* The attributes for the instance types. When you specify instance attributes, Amazon EC2 will identify instance
* types with those attributes.
*
*
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*
*
* @param instanceRequirements
* The attributes for the instance types. When you specify instance attributes, Amazon EC2 will identify
* instance types with those attributes.
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*/
public void setInstanceRequirements(InstanceRequirements instanceRequirements) {
this.instanceRequirements = instanceRequirements;
}
/**
*
* The attributes for the instance types. When you specify instance attributes, Amazon EC2 will identify instance
* types with those attributes.
*
*
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*
*
* @return The attributes for the instance types. When you specify instance attributes, Amazon EC2 will identify
* instance types with those attributes.
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*/
public InstanceRequirements getInstanceRequirements() {
return this.instanceRequirements;
}
/**
*
* The attributes for the instance types. When you specify instance attributes, Amazon EC2 will identify instance
* types with those attributes.
*
*
*
* If you specify InstanceRequirements
, you can't specify InstanceType
.
*
*
*
* @param instanceRequirements
* The attributes for the instance types. When you specify instance attributes, Amazon EC2 will identify
* instance types with those attributes.
*
* 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 FleetLaunchTemplateOverrides withInstanceRequirements(InstanceRequirements instanceRequirements) {
setInstanceRequirements(instanceRequirements);
return this;
}
/**
*
* The ID of the AMI. An AMI is required to launch an instance. This parameter is only available for fleets of type
* instant
. For fleets of type maintain
and request
, you must specify the AMI
* ID in the launch template.
*
*
* @param imageId
* The ID of the AMI. An AMI is required to launch an instance. This parameter is only available for fleets
* of type instant
. For fleets of type maintain
and request
, you must
* specify the AMI ID in the launch template.
*/
public void setImageId(String imageId) {
this.imageId = imageId;
}
/**
*
* The ID of the AMI. An AMI is required to launch an instance. This parameter is only available for fleets of type
* instant
. For fleets of type maintain
and request
, you must specify the AMI
* ID in the launch template.
*
*
* @return The ID of the AMI. An AMI is required to launch an instance. This parameter is only available for fleets
* of type instant
. For fleets of type maintain
and request
, you must
* specify the AMI ID in the launch template.
*/
public String getImageId() {
return this.imageId;
}
/**
*
* The ID of the AMI. An AMI is required to launch an instance. This parameter is only available for fleets of type
* instant
. For fleets of type maintain
and request
, you must specify the AMI
* ID in the launch template.
*
*
* @param imageId
* The ID of the AMI. An AMI is required to launch an instance. This parameter is only available for fleets
* of type instant
. For fleets of type maintain
and request
, you must
* specify the AMI ID in the launch template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FleetLaunchTemplateOverrides withImageId(String imageId) {
setImageId(imageId);
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 (getMaxPrice() != null)
sb.append("MaxPrice: ").append(getMaxPrice()).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 (getPlacement() != null)
sb.append("Placement: ").append(getPlacement()).append(",");
if (getInstanceRequirements() != null)
sb.append("InstanceRequirements: ").append(getInstanceRequirements()).append(",");
if (getImageId() != null)
sb.append("ImageId: ").append(getImageId());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof FleetLaunchTemplateOverrides == false)
return false;
FleetLaunchTemplateOverrides other = (FleetLaunchTemplateOverrides) obj;
if (other.getInstanceType() == null ^ this.getInstanceType() == null)
return false;
if (other.getInstanceType() != null && other.getInstanceType().equals(this.getInstanceType()) == false)
return false;
if (other.getMaxPrice() == null ^ this.getMaxPrice() == null)
return false;
if (other.getMaxPrice() != null && other.getMaxPrice().equals(this.getMaxPrice()) == 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.getPlacement() == null ^ this.getPlacement() == null)
return false;
if (other.getPlacement() != null && other.getPlacement().equals(this.getPlacement()) == false)
return false;
if (other.getInstanceRequirements() == null ^ this.getInstanceRequirements() == null)
return false;
if (other.getInstanceRequirements() != null && other.getInstanceRequirements().equals(this.getInstanceRequirements()) == false)
return false;
if (other.getImageId() == null ^ this.getImageId() == null)
return false;
if (other.getImageId() != null && other.getImageId().equals(this.getImageId()) == 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 + ((getMaxPrice() == null) ? 0 : getMaxPrice().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 + ((getPlacement() == null) ? 0 : getPlacement().hashCode());
hashCode = prime * hashCode + ((getInstanceRequirements() == null) ? 0 : getInstanceRequirements().hashCode());
hashCode = prime * hashCode + ((getImageId() == null) ? 0 : getImageId().hashCode());
return hashCode;
}
@Override
public FleetLaunchTemplateOverrides clone() {
try {
return (FleetLaunchTemplateOverrides) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}