com.amazonaws.services.ec2.model.CapacityAllocation 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;
/**
*
* Information about instance capacity usage for a Capacity Reservation.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CapacityAllocation implements Serializable, Cloneable {
/**
*
* The usage type. used
indicates that the instance capacity is in use by instances that are running in
* the Capacity Reservation.
*
*/
private String allocationType;
/**
*
* The amount of instance capacity associated with the usage. For example a value of 4
indicates that
* instance capacity for 4 instances is currently in use.
*
*/
private Integer count;
/**
*
* The usage type. used
indicates that the instance capacity is in use by instances that are running in
* the Capacity Reservation.
*
*
* @param allocationType
* The usage type. used
indicates that the instance capacity is in use by instances that are
* running in the Capacity Reservation.
* @see AllocationType
*/
public void setAllocationType(String allocationType) {
this.allocationType = allocationType;
}
/**
*
* The usage type. used
indicates that the instance capacity is in use by instances that are running in
* the Capacity Reservation.
*
*
* @return The usage type. used
indicates that the instance capacity is in use by instances that are
* running in the Capacity Reservation.
* @see AllocationType
*/
public String getAllocationType() {
return this.allocationType;
}
/**
*
* The usage type. used
indicates that the instance capacity is in use by instances that are running in
* the Capacity Reservation.
*
*
* @param allocationType
* The usage type. used
indicates that the instance capacity is in use by instances that are
* running in the Capacity Reservation.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AllocationType
*/
public CapacityAllocation withAllocationType(String allocationType) {
setAllocationType(allocationType);
return this;
}
/**
*
* The usage type. used
indicates that the instance capacity is in use by instances that are running in
* the Capacity Reservation.
*
*
* @param allocationType
* The usage type. used
indicates that the instance capacity is in use by instances that are
* running in the Capacity Reservation.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AllocationType
*/
public CapacityAllocation withAllocationType(AllocationType allocationType) {
this.allocationType = allocationType.toString();
return this;
}
/**
*
* The amount of instance capacity associated with the usage. For example a value of 4
indicates that
* instance capacity for 4 instances is currently in use.
*
*
* @param count
* The amount of instance capacity associated with the usage. For example a value of 4
indicates
* that instance capacity for 4 instances is currently in use.
*/
public void setCount(Integer count) {
this.count = count;
}
/**
*
* The amount of instance capacity associated with the usage. For example a value of 4
indicates that
* instance capacity for 4 instances is currently in use.
*
*
* @return The amount of instance capacity associated with the usage. For example a value of 4
* indicates that instance capacity for 4 instances is currently in use.
*/
public Integer getCount() {
return this.count;
}
/**
*
* The amount of instance capacity associated with the usage. For example a value of 4
indicates that
* instance capacity for 4 instances is currently in use.
*
*
* @param count
* The amount of instance capacity associated with the usage. For example a value of 4
indicates
* that instance capacity for 4 instances is currently in use.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CapacityAllocation withCount(Integer count) {
setCount(count);
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 (getAllocationType() != null)
sb.append("AllocationType: ").append(getAllocationType()).append(",");
if (getCount() != null)
sb.append("Count: ").append(getCount());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CapacityAllocation == false)
return false;
CapacityAllocation other = (CapacityAllocation) obj;
if (other.getAllocationType() == null ^ this.getAllocationType() == null)
return false;
if (other.getAllocationType() != null && other.getAllocationType().equals(this.getAllocationType()) == false)
return false;
if (other.getCount() == null ^ this.getCount() == null)
return false;
if (other.getCount() != null && other.getCount().equals(this.getCount()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAllocationType() == null) ? 0 : getAllocationType().hashCode());
hashCode = prime * hashCode + ((getCount() == null) ? 0 : getCount().hashCode());
return hashCode;
}
@Override
public CapacityAllocation clone() {
try {
return (CapacityAllocation) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}