com.amazonaws.services.ec2.model.PurchaseHostReservationResult Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
* Copyright 2011-2016 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;
/**
*
*/
public class PurchaseHostReservationResult implements Serializable, Cloneable {
/**
*
* Describes the details of the purchase.
*
*/
private com.amazonaws.internal.SdkInternalList purchase;
/**
*
* The total amount that will be charged to your account when you purchase
* the reservation.
*
*/
private String totalUpfrontPrice;
/**
*
* The total hourly price of the reservation calculated per hour.
*
*/
private String totalHourlyPrice;
/**
*
* The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this time, the
* only supported currency is USD.
*
*/
private String currencyCode;
/**
*
* Unique, case-sensitive identifier you provide to ensure idempotency of
* the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute Cloud
* User Guide
*
*/
private String clientToken;
/**
*
* Describes the details of the purchase.
*
*
* @return Describes the details of the purchase.
*/
public java.util.List getPurchase() {
if (purchase == null) {
purchase = new com.amazonaws.internal.SdkInternalList();
}
return purchase;
}
/**
*
* Describes the details of the purchase.
*
*
* @param purchase
* Describes the details of the purchase.
*/
public void setPurchase(java.util.Collection purchase) {
if (purchase == null) {
this.purchase = null;
return;
}
this.purchase = new com.amazonaws.internal.SdkInternalList(
purchase);
}
/**
*
* Describes the details of the purchase.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setPurchase(java.util.Collection)} or
* {@link #withPurchase(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param purchase
* Describes the details of the purchase.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public PurchaseHostReservationResult withPurchase(Purchase... purchase) {
if (this.purchase == null) {
setPurchase(new com.amazonaws.internal.SdkInternalList(
purchase.length));
}
for (Purchase ele : purchase) {
this.purchase.add(ele);
}
return this;
}
/**
*
* Describes the details of the purchase.
*
*
* @param purchase
* Describes the details of the purchase.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public PurchaseHostReservationResult withPurchase(
java.util.Collection purchase) {
setPurchase(purchase);
return this;
}
/**
*
* The total amount that will be charged to your account when you purchase
* the reservation.
*
*
* @param totalUpfrontPrice
* The total amount that will be charged to your account when you
* purchase the reservation.
*/
public void setTotalUpfrontPrice(String totalUpfrontPrice) {
this.totalUpfrontPrice = totalUpfrontPrice;
}
/**
*
* The total amount that will be charged to your account when you purchase
* the reservation.
*
*
* @return The total amount that will be charged to your account when you
* purchase the reservation.
*/
public String getTotalUpfrontPrice() {
return this.totalUpfrontPrice;
}
/**
*
* The total amount that will be charged to your account when you purchase
* the reservation.
*
*
* @param totalUpfrontPrice
* The total amount that will be charged to your account when you
* purchase the reservation.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public PurchaseHostReservationResult withTotalUpfrontPrice(
String totalUpfrontPrice) {
setTotalUpfrontPrice(totalUpfrontPrice);
return this;
}
/**
*
* The total hourly price of the reservation calculated per hour.
*
*
* @param totalHourlyPrice
* The total hourly price of the reservation calculated per hour.
*/
public void setTotalHourlyPrice(String totalHourlyPrice) {
this.totalHourlyPrice = totalHourlyPrice;
}
/**
*
* The total hourly price of the reservation calculated per hour.
*
*
* @return The total hourly price of the reservation calculated per hour.
*/
public String getTotalHourlyPrice() {
return this.totalHourlyPrice;
}
/**
*
* The total hourly price of the reservation calculated per hour.
*
*
* @param totalHourlyPrice
* The total hourly price of the reservation calculated per hour.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public PurchaseHostReservationResult withTotalHourlyPrice(
String totalHourlyPrice) {
setTotalHourlyPrice(totalHourlyPrice);
return this;
}
/**
*
* The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this time, the
* only supported currency is USD.
*
*
* @param currencyCode
* The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this time,
* the only supported currency is USD.
* @see CurrencyCodeValues
*/
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
/**
*
* The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this time, the
* only supported currency is USD.
*
*
* @return The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this
* time, the only supported currency is USD.
* @see CurrencyCodeValues
*/
public String getCurrencyCode() {
return this.currencyCode;
}
/**
*
* The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this time, the
* only supported currency is USD.
*
*
* @param currencyCode
* The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this time,
* the only supported currency is USD.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see CurrencyCodeValues
*/
public PurchaseHostReservationResult withCurrencyCode(String currencyCode) {
setCurrencyCode(currencyCode);
return this;
}
/**
*
* The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this time, the
* only supported currency is USD.
*
*
* @param currencyCode
* The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this time,
* the only supported currency is USD.
* @see CurrencyCodeValues
*/
public void setCurrencyCode(CurrencyCodeValues currencyCode) {
this.currencyCode = currencyCode.toString();
}
/**
*
* The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this time, the
* only supported currency is USD.
*
*
* @param currencyCode
* The currency in which the totalUpfrontPrice and
* totalHourlyPrice amounts are specified. At this time,
* the only supported currency is USD.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see CurrencyCodeValues
*/
public PurchaseHostReservationResult withCurrencyCode(
CurrencyCodeValues currencyCode) {
setCurrencyCode(currencyCode);
return this;
}
/**
*
* Unique, case-sensitive identifier you provide to ensure idempotency of
* the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute Cloud
* User Guide
*
*
* @param clientToken
* Unique, case-sensitive identifier you provide to ensure
* idempotency of the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute
* Cloud User Guide
*/
public void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
/**
*
* Unique, case-sensitive identifier you provide to ensure idempotency of
* the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute Cloud
* User Guide
*
*
* @return Unique, case-sensitive identifier you provide to ensure
* idempotency of the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute
* Cloud User Guide
*/
public String getClientToken() {
return this.clientToken;
}
/**
*
* Unique, case-sensitive identifier you provide to ensure idempotency of
* the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute Cloud
* User Guide
*
*
* @param clientToken
* Unique, case-sensitive identifier you provide to ensure
* idempotency of the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute
* Cloud User Guide
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public PurchaseHostReservationResult withClientToken(String clientToken) {
setClientToken(clientToken);
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 (getPurchase() != null)
sb.append("Purchase: " + getPurchase() + ",");
if (getTotalUpfrontPrice() != null)
sb.append("TotalUpfrontPrice: " + getTotalUpfrontPrice() + ",");
if (getTotalHourlyPrice() != null)
sb.append("TotalHourlyPrice: " + getTotalHourlyPrice() + ",");
if (getCurrencyCode() != null)
sb.append("CurrencyCode: " + getCurrencyCode() + ",");
if (getClientToken() != null)
sb.append("ClientToken: " + getClientToken());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof PurchaseHostReservationResult == false)
return false;
PurchaseHostReservationResult other = (PurchaseHostReservationResult) obj;
if (other.getPurchase() == null ^ this.getPurchase() == null)
return false;
if (other.getPurchase() != null
&& other.getPurchase().equals(this.getPurchase()) == false)
return false;
if (other.getTotalUpfrontPrice() == null
^ this.getTotalUpfrontPrice() == null)
return false;
if (other.getTotalUpfrontPrice() != null
&& other.getTotalUpfrontPrice().equals(
this.getTotalUpfrontPrice()) == false)
return false;
if (other.getTotalHourlyPrice() == null
^ this.getTotalHourlyPrice() == null)
return false;
if (other.getTotalHourlyPrice() != null
&& other.getTotalHourlyPrice().equals(
this.getTotalHourlyPrice()) == false)
return false;
if (other.getCurrencyCode() == null ^ this.getCurrencyCode() == null)
return false;
if (other.getCurrencyCode() != null
&& other.getCurrencyCode().equals(this.getCurrencyCode()) == false)
return false;
if (other.getClientToken() == null ^ this.getClientToken() == null)
return false;
if (other.getClientToken() != null
&& other.getClientToken().equals(this.getClientToken()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getPurchase() == null) ? 0 : getPurchase().hashCode());
hashCode = prime
* hashCode
+ ((getTotalUpfrontPrice() == null) ? 0
: getTotalUpfrontPrice().hashCode());
hashCode = prime
* hashCode
+ ((getTotalHourlyPrice() == null) ? 0 : getTotalHourlyPrice()
.hashCode());
hashCode = prime
* hashCode
+ ((getCurrencyCode() == null) ? 0 : getCurrencyCode()
.hashCode());
hashCode = prime
* hashCode
+ ((getClientToken() == null) ? 0 : getClientToken().hashCode());
return hashCode;
}
@Override
public PurchaseHostReservationResult clone() {
try {
return (PurchaseHostReservationResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}