com.amazonaws.services.ec2.model.TargetCapacitySpecification Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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 in terms of instances or 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.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TargetCapacitySpecification 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 maximum number of Spot units to launch.
*
*/
private Integer spotTargetCapacity;
/**
*
* The default TotalTargetCapacity
, which is either Spot
or On-Demand
.
*
*/
private String defaultTargetCapacityType;
/**
*
* 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 TargetCapacitySpecification 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 TargetCapacitySpecification withOnDemandTargetCapacity(Integer onDemandTargetCapacity) {
setOnDemandTargetCapacity(onDemandTargetCapacity);
return this;
}
/**
*
* The maximum number of Spot units to launch.
*
*
* @param spotTargetCapacity
* The maximum number of Spot units to launch.
*/
public void setSpotTargetCapacity(Integer spotTargetCapacity) {
this.spotTargetCapacity = spotTargetCapacity;
}
/**
*
* The maximum number of Spot units to launch.
*
*
* @return The maximum number of Spot units to launch.
*/
public Integer getSpotTargetCapacity() {
return this.spotTargetCapacity;
}
/**
*
* The maximum number of Spot units to launch.
*
*
* @param spotTargetCapacity
* The maximum number of Spot units to launch.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetCapacitySpecification 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 TargetCapacitySpecification 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 TargetCapacitySpecification withDefaultTargetCapacityType(DefaultTargetCapacityType defaultTargetCapacityType) {
this.defaultTargetCapacityType = defaultTargetCapacityType.toString();
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @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());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TargetCapacitySpecification == false)
return false;
TargetCapacitySpecification other = (TargetCapacitySpecification) 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;
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());
return hashCode;
}
@Override
public TargetCapacitySpecification clone() {
try {
return (TargetCapacitySpecification) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}