com.amazonaws.services.ec2.model.TargetCapacitySpecificationRequest 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;
/**
*
* The number of units to request. You can choose to set the target capacity as the number of instances. Or you can set
* the target capacity to a performance characteristic that is important to your application workload, such as vCPUs,
* memory, or I/O. If the request type is maintain
, you can specify a target capacity of 0 and add capacity
* later.
*
*
* You can use the On-Demand Instance MaxTotalPrice
parameter, the Spot Instance MaxTotalPrice
* parameter, or both parameters to ensure that your fleet cost does not exceed your budget. If you set a maximum price
* per hour for the On-Demand Instances and Spot Instances in your request, EC2 Fleet will launch instances until it
* reaches the maximum amount that you're willing to pay. When the maximum amount you're willing to pay is reached, the
* fleet stops launching instances even if it hasn’t met the target capacity. The MaxTotalPrice
parameters
* are located in OnDemandOptionsRequest
* and SpotOptionsRequest.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TargetCapacitySpecificationRequest implements Serializable, Cloneable {
/**
*
* The number of units to request, filled using DefaultTargetCapacityType
.
*
*/
private Integer totalTargetCapacity;
/**
*
* The number of On-Demand units to request.
*
*/
private Integer onDemandTargetCapacity;
/**
*
* The number of Spot units to request.
*
*/
private Integer spotTargetCapacity;
/**
*
* The default TotalTargetCapacity
, which is either Spot
or On-Demand
.
*
*/
private String defaultTargetCapacityType;
/**
*
* The unit for the target capacity. TargetCapacityUnitType
can only be specified when
* InstanceRequirements
is specified.
*
*
* Default: units
(translates to number of instances)
*
*/
private String targetCapacityUnitType;
/**
*
* The number of units to request, filled using DefaultTargetCapacityType
.
*
*
* @param totalTargetCapacity
* The number of units to request, filled using DefaultTargetCapacityType
.
*/
public void setTotalTargetCapacity(Integer totalTargetCapacity) {
this.totalTargetCapacity = totalTargetCapacity;
}
/**
*
* The number of units to request, filled using DefaultTargetCapacityType
.
*
*
* @return The number of units to request, filled using DefaultTargetCapacityType
.
*/
public Integer getTotalTargetCapacity() {
return this.totalTargetCapacity;
}
/**
*
* The number of units to request, filled using DefaultTargetCapacityType
.
*
*
* @param totalTargetCapacity
* The number of units to request, filled using DefaultTargetCapacityType
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetCapacitySpecificationRequest withTotalTargetCapacity(Integer totalTargetCapacity) {
setTotalTargetCapacity(totalTargetCapacity);
return this;
}
/**
*
* The number of On-Demand units to request.
*
*
* @param onDemandTargetCapacity
* The number of On-Demand units to request.
*/
public void setOnDemandTargetCapacity(Integer onDemandTargetCapacity) {
this.onDemandTargetCapacity = onDemandTargetCapacity;
}
/**
*
* The number of On-Demand units to request.
*
*
* @return The number of On-Demand units to request.
*/
public Integer getOnDemandTargetCapacity() {
return this.onDemandTargetCapacity;
}
/**
*
* The number of On-Demand units to request.
*
*
* @param onDemandTargetCapacity
* The number of On-Demand units to request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetCapacitySpecificationRequest withOnDemandTargetCapacity(Integer onDemandTargetCapacity) {
setOnDemandTargetCapacity(onDemandTargetCapacity);
return this;
}
/**
*
* The number of Spot units to request.
*
*
* @param spotTargetCapacity
* The number of Spot units to request.
*/
public void setSpotTargetCapacity(Integer spotTargetCapacity) {
this.spotTargetCapacity = spotTargetCapacity;
}
/**
*
* The number of Spot units to request.
*
*
* @return The number of Spot units to request.
*/
public Integer getSpotTargetCapacity() {
return this.spotTargetCapacity;
}
/**
*
* The number of Spot units to request.
*
*
* @param spotTargetCapacity
* The number of Spot units to request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetCapacitySpecificationRequest withSpotTargetCapacity(Integer spotTargetCapacity) {
setSpotTargetCapacity(spotTargetCapacity);
return this;
}
/**
*
* The default TotalTargetCapacity
, which is either Spot
or On-Demand
.
*
*
* @param defaultTargetCapacityType
* The default TotalTargetCapacity
, which is either Spot
or On-Demand
.
* @see DefaultTargetCapacityType
*/
public void setDefaultTargetCapacityType(String defaultTargetCapacityType) {
this.defaultTargetCapacityType = defaultTargetCapacityType;
}
/**
*
* The default TotalTargetCapacity
, which is either Spot
or On-Demand
.
*
*
* @return The default TotalTargetCapacity
, which is either Spot
or On-Demand
* .
* @see DefaultTargetCapacityType
*/
public String getDefaultTargetCapacityType() {
return this.defaultTargetCapacityType;
}
/**
*
* The default TotalTargetCapacity
, which is either Spot
or On-Demand
.
*
*
* @param defaultTargetCapacityType
* The default TotalTargetCapacity
, which is either Spot
or On-Demand
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see DefaultTargetCapacityType
*/
public TargetCapacitySpecificationRequest withDefaultTargetCapacityType(String defaultTargetCapacityType) {
setDefaultTargetCapacityType(defaultTargetCapacityType);
return this;
}
/**
*
* The default TotalTargetCapacity
, which is either Spot
or On-Demand
.
*
*
* @param defaultTargetCapacityType
* The default TotalTargetCapacity
, which is either Spot
or On-Demand
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see DefaultTargetCapacityType
*/
public TargetCapacitySpecificationRequest withDefaultTargetCapacityType(DefaultTargetCapacityType defaultTargetCapacityType) {
this.defaultTargetCapacityType = defaultTargetCapacityType.toString();
return this;
}
/**
*
* The unit for the target capacity. TargetCapacityUnitType
can only be specified when
* InstanceRequirements
is specified.
*
*
* Default: units
(translates to number of instances)
*
*
* @param targetCapacityUnitType
* The unit for the target capacity. TargetCapacityUnitType
can only be specified when
* InstanceRequirements
is specified.
*
* Default: units
(translates to number of instances)
* @see TargetCapacityUnitType
*/
public void setTargetCapacityUnitType(String targetCapacityUnitType) {
this.targetCapacityUnitType = targetCapacityUnitType;
}
/**
*
* The unit for the target capacity. TargetCapacityUnitType
can only be specified when
* InstanceRequirements
is specified.
*
*
* Default: units
(translates to number of instances)
*
*
* @return The unit for the target capacity. TargetCapacityUnitType
can only be specified when
* InstanceRequirements
is specified.
*
* Default: units
(translates to number of instances)
* @see TargetCapacityUnitType
*/
public String getTargetCapacityUnitType() {
return this.targetCapacityUnitType;
}
/**
*
* The unit for the target capacity. TargetCapacityUnitType
can only be specified when
* InstanceRequirements
is specified.
*
*
* Default: units
(translates to number of instances)
*
*
* @param targetCapacityUnitType
* The unit for the target capacity. TargetCapacityUnitType
can only be specified when
* InstanceRequirements
is specified.
*
* Default: units
(translates to number of instances)
* @return Returns a reference to this object so that method calls can be chained together.
* @see TargetCapacityUnitType
*/
public TargetCapacitySpecificationRequest withTargetCapacityUnitType(String targetCapacityUnitType) {
setTargetCapacityUnitType(targetCapacityUnitType);
return this;
}
/**
*
* The unit for the target capacity. TargetCapacityUnitType
can only be specified when
* InstanceRequirements
is specified.
*
*
* Default: units
(translates to number of instances)
*
*
* @param targetCapacityUnitType
* The unit for the target capacity. TargetCapacityUnitType
can only be specified when
* InstanceRequirements
is specified.
*
* Default: units
(translates to number of instances)
* @return Returns a reference to this object so that method calls can be chained together.
* @see TargetCapacityUnitType
*/
public TargetCapacitySpecificationRequest withTargetCapacityUnitType(TargetCapacityUnitType targetCapacityUnitType) {
this.targetCapacityUnitType = targetCapacityUnitType.toString();
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 (getTotalTargetCapacity() != null)
sb.append("TotalTargetCapacity: ").append(getTotalTargetCapacity()).append(",");
if (getOnDemandTargetCapacity() != null)
sb.append("OnDemandTargetCapacity: ").append(getOnDemandTargetCapacity()).append(",");
if (getSpotTargetCapacity() != null)
sb.append("SpotTargetCapacity: ").append(getSpotTargetCapacity()).append(",");
if (getDefaultTargetCapacityType() != null)
sb.append("DefaultTargetCapacityType: ").append(getDefaultTargetCapacityType()).append(",");
if (getTargetCapacityUnitType() != null)
sb.append("TargetCapacityUnitType: ").append(getTargetCapacityUnitType());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TargetCapacitySpecificationRequest == false)
return false;
TargetCapacitySpecificationRequest other = (TargetCapacitySpecificationRequest) obj;
if (other.getTotalTargetCapacity() == null ^ this.getTotalTargetCapacity() == null)
return false;
if (other.getTotalTargetCapacity() != null && other.getTotalTargetCapacity().equals(this.getTotalTargetCapacity()) == false)
return false;
if (other.getOnDemandTargetCapacity() == null ^ this.getOnDemandTargetCapacity() == null)
return false;
if (other.getOnDemandTargetCapacity() != null && other.getOnDemandTargetCapacity().equals(this.getOnDemandTargetCapacity()) == false)
return false;
if (other.getSpotTargetCapacity() == null ^ this.getSpotTargetCapacity() == null)
return false;
if (other.getSpotTargetCapacity() != null && other.getSpotTargetCapacity().equals(this.getSpotTargetCapacity()) == false)
return false;
if (other.getDefaultTargetCapacityType() == null ^ this.getDefaultTargetCapacityType() == null)
return false;
if (other.getDefaultTargetCapacityType() != null && other.getDefaultTargetCapacityType().equals(this.getDefaultTargetCapacityType()) == false)
return false;
if (other.getTargetCapacityUnitType() == null ^ this.getTargetCapacityUnitType() == null)
return false;
if (other.getTargetCapacityUnitType() != null && other.getTargetCapacityUnitType().equals(this.getTargetCapacityUnitType()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getTotalTargetCapacity() == null) ? 0 : getTotalTargetCapacity().hashCode());
hashCode = prime * hashCode + ((getOnDemandTargetCapacity() == null) ? 0 : getOnDemandTargetCapacity().hashCode());
hashCode = prime * hashCode + ((getSpotTargetCapacity() == null) ? 0 : getSpotTargetCapacity().hashCode());
hashCode = prime * hashCode + ((getDefaultTargetCapacityType() == null) ? 0 : getDefaultTargetCapacityType().hashCode());
hashCode = prime * hashCode + ((getTargetCapacityUnitType() == null) ? 0 : getTargetCapacityUnitType().hashCode());
return hashCode;
}
@Override
public TargetCapacitySpecificationRequest clone() {
try {
return (TargetCapacitySpecificationRequest) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}