com.amazonaws.services.ec2.model.HostOffering 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;
/**
 * 
 * Details about the Dedicated Host Reservation offering.
 * 
 */
public class HostOffering implements Serializable, Cloneable {
    /**
     * 
     * The ID of the offering.
     * 
     */
    private String offeringId;
    /**
     * 
     * The instance family that the offering covers.
     * 
     */
    private String instanceFamily;
    /**
     * 
     * The available payment option.
     * 
     */
    private String paymentOption;
    /**
     * 
     * The upfront price of the offering. Does not apply to No Upfront
     * offerings.
     * 
     */
    private String upfrontPrice;
    /**
     * 
     * The hourly price of the offering.
     * 
     */
    private String hourlyPrice;
    /**
     * 
     * The currency of the offering.
     * 
     */
    private String currencyCode;
    /**
     * 
     * The duration of the offering (in seconds).
     * 
     */
    private Integer duration;
    /**
     * 
     * The ID of the offering.
     * 
     * 
     * @param offeringId
     *        The ID of the offering.
     */
    public void setOfferingId(String offeringId) {
        this.offeringId = offeringId;
    }
    /**
     * 
     * The ID of the offering.
     * 
     * 
     * @return The ID of the offering.
     */
    public String getOfferingId() {
        return this.offeringId;
    }
    /**
     * 
     * The ID of the offering.
     * 
     * 
     * @param offeringId
     *        The ID of the offering.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public HostOffering withOfferingId(String offeringId) {
        setOfferingId(offeringId);
        return this;
    }
    /**
     * 
     * The instance family that the offering covers.
     * 
     * 
     * @param instanceFamily
     *        The instance family that the offering covers.
     */
    public void setInstanceFamily(String instanceFamily) {
        this.instanceFamily = instanceFamily;
    }
    /**
     * 
     * The instance family that the offering covers.
     * 
     * 
     * @return The instance family that the offering covers.
     */
    public String getInstanceFamily() {
        return this.instanceFamily;
    }
    /**
     * 
     * The instance family that the offering covers.
     * 
     * 
     * @param instanceFamily
     *        The instance family that the offering covers.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public HostOffering withInstanceFamily(String instanceFamily) {
        setInstanceFamily(instanceFamily);
        return this;
    }
    /**
     * 
     * The available payment option.
     * 
     * 
     * @param paymentOption
     *        The available payment option.
     * @see PaymentOption
     */
    public void setPaymentOption(String paymentOption) {
        this.paymentOption = paymentOption;
    }
    /**
     * 
     * The available payment option.
     * 
     * 
     * @return The available payment option.
     * @see PaymentOption
     */
    public String getPaymentOption() {
        return this.paymentOption;
    }
    /**
     * 
     * The available payment option.
     * 
     * 
     * @param paymentOption
     *        The available payment option.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see PaymentOption
     */
    public HostOffering withPaymentOption(String paymentOption) {
        setPaymentOption(paymentOption);
        return this;
    }
    /**
     * 
     * The available payment option.
     * 
     * 
     * @param paymentOption
     *        The available payment option.
     * @see PaymentOption
     */
    public void setPaymentOption(PaymentOption paymentOption) {
        this.paymentOption = paymentOption.toString();
    }
    /**
     * 
     * The available payment option.
     * 
     * 
     * @param paymentOption
     *        The available payment option.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see PaymentOption
     */
    public HostOffering withPaymentOption(PaymentOption paymentOption) {
        setPaymentOption(paymentOption);
        return this;
    }
    /**
     * 
     * The upfront price of the offering. Does not apply to No Upfront
     * offerings.
     * 
     * 
     * @param upfrontPrice
     *        The upfront price of the offering. Does not apply to No Upfront
     *        offerings.
     */
    public void setUpfrontPrice(String upfrontPrice) {
        this.upfrontPrice = upfrontPrice;
    }
    /**
     * 
     * The upfront price of the offering. Does not apply to No Upfront
     * offerings.
     * 
     * 
     * @return The upfront price of the offering. Does not apply to No Upfront
     *         offerings.
     */
    public String getUpfrontPrice() {
        return this.upfrontPrice;
    }
    /**
     * 
     * The upfront price of the offering. Does not apply to No Upfront
     * offerings.
     * 
     * 
     * @param upfrontPrice
     *        The upfront price of the offering. Does not apply to No Upfront
     *        offerings.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public HostOffering withUpfrontPrice(String upfrontPrice) {
        setUpfrontPrice(upfrontPrice);
        return this;
    }
    /**
     * 
     * The hourly price of the offering.
     * 
     * 
     * @param hourlyPrice
     *        The hourly price of the offering.
     */
    public void setHourlyPrice(String hourlyPrice) {
        this.hourlyPrice = hourlyPrice;
    }
    /**
     * 
     * The hourly price of the offering.
     * 
     * 
     * @return The hourly price of the offering.
     */
    public String getHourlyPrice() {
        return this.hourlyPrice;
    }
    /**
     * 
     * The hourly price of the offering.
     * 
     * 
     * @param hourlyPrice
     *        The hourly price of the offering.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public HostOffering withHourlyPrice(String hourlyPrice) {
        setHourlyPrice(hourlyPrice);
        return this;
    }
    /**
     * 
     * The currency of the offering.
     * 
     * 
     * @param currencyCode
     *        The currency of the offering.
     * @see CurrencyCodeValues
     */
    public void setCurrencyCode(String currencyCode) {
        this.currencyCode = currencyCode;
    }
    /**
     * 
     * The currency of the offering.
     * 
     * 
     * @return The currency of the offering.
     * @see CurrencyCodeValues
     */
    public String getCurrencyCode() {
        return this.currencyCode;
    }
    /**
     * 
     * The currency of the offering.
     * 
     * 
     * @param currencyCode
     *        The currency of the offering.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see CurrencyCodeValues
     */
    public HostOffering withCurrencyCode(String currencyCode) {
        setCurrencyCode(currencyCode);
        return this;
    }
    /**
     * 
     * The currency of the offering.
     * 
     * 
     * @param currencyCode
     *        The currency of the offering.
     * @see CurrencyCodeValues
     */
    public void setCurrencyCode(CurrencyCodeValues currencyCode) {
        this.currencyCode = currencyCode.toString();
    }
    /**
     * 
     * The currency of the offering.
     * 
     * 
     * @param currencyCode
     *        The currency of the offering.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see CurrencyCodeValues
     */
    public HostOffering withCurrencyCode(CurrencyCodeValues currencyCode) {
        setCurrencyCode(currencyCode);
        return this;
    }
    /**
     * 
     * The duration of the offering (in seconds).
     * 
     * 
     * @param duration
     *        The duration of the offering (in seconds).
     */
    public void setDuration(Integer duration) {
        this.duration = duration;
    }
    /**
     * 
     * The duration of the offering (in seconds).
     * 
     * 
     * @return The duration of the offering (in seconds).
     */
    public Integer getDuration() {
        return this.duration;
    }
    /**
     * 
     * The duration of the offering (in seconds).
     * 
     * 
     * @param duration
     *        The duration of the offering (in seconds).
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public HostOffering withDuration(Integer duration) {
        setDuration(duration);
        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 (getOfferingId() != null)
            sb.append("OfferingId: " + getOfferingId() + ",");
        if (getInstanceFamily() != null)
            sb.append("InstanceFamily: " + getInstanceFamily() + ",");
        if (getPaymentOption() != null)
            sb.append("PaymentOption: " + getPaymentOption() + ",");
        if (getUpfrontPrice() != null)
            sb.append("UpfrontPrice: " + getUpfrontPrice() + ",");
        if (getHourlyPrice() != null)
            sb.append("HourlyPrice: " + getHourlyPrice() + ",");
        if (getCurrencyCode() != null)
            sb.append("CurrencyCode: " + getCurrencyCode() + ",");
        if (getDuration() != null)
            sb.append("Duration: " + getDuration());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof HostOffering == false)
            return false;
        HostOffering other = (HostOffering) obj;
        if (other.getOfferingId() == null ^ this.getOfferingId() == null)
            return false;
        if (other.getOfferingId() != null
                && other.getOfferingId().equals(this.getOfferingId()) == false)
            return false;
        if (other.getInstanceFamily() == null
                ^ this.getInstanceFamily() == null)
            return false;
        if (other.getInstanceFamily() != null
                && other.getInstanceFamily().equals(this.getInstanceFamily()) == false)
            return false;
        if (other.getPaymentOption() == null ^ this.getPaymentOption() == null)
            return false;
        if (other.getPaymentOption() != null
                && other.getPaymentOption().equals(this.getPaymentOption()) == false)
            return false;
        if (other.getUpfrontPrice() == null ^ this.getUpfrontPrice() == null)
            return false;
        if (other.getUpfrontPrice() != null
                && other.getUpfrontPrice().equals(this.getUpfrontPrice()) == false)
            return false;
        if (other.getHourlyPrice() == null ^ this.getHourlyPrice() == null)
            return false;
        if (other.getHourlyPrice() != null
                && other.getHourlyPrice().equals(this.getHourlyPrice()) == 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.getDuration() == null ^ this.getDuration() == null)
            return false;
        if (other.getDuration() != null
                && other.getDuration().equals(this.getDuration()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime * hashCode
                + ((getOfferingId() == null) ? 0 : getOfferingId().hashCode());
        hashCode = prime
                * hashCode
                + ((getInstanceFamily() == null) ? 0 : getInstanceFamily()
                        .hashCode());
        hashCode = prime
                * hashCode
                + ((getPaymentOption() == null) ? 0 : getPaymentOption()
                        .hashCode());
        hashCode = prime
                * hashCode
                + ((getUpfrontPrice() == null) ? 0 : getUpfrontPrice()
                        .hashCode());
        hashCode = prime
                * hashCode
                + ((getHourlyPrice() == null) ? 0 : getHourlyPrice().hashCode());
        hashCode = prime
                * hashCode
                + ((getCurrencyCode() == null) ? 0 : getCurrencyCode()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getDuration() == null) ? 0 : getDuration().hashCode());
        return hashCode;
    }
    @Override
    public HostOffering clone() {
        try {
            return (HostOffering) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}