com.amazonaws.services.ec2.model.SpotDatafeedSubscription Maven / Gradle / Ivy
Show all versions of aws-java-sdk-osgi Show documentation
/*
 * Copyright 2010-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;
/**
 * 
 * Describes the data feed for a Spot instance.
 * 
 */
public class SpotDatafeedSubscription implements Serializable, Cloneable {
    /**
     * 
     * The AWS account ID of the account.
     * 
     */
    private String ownerId;
    /**
     * 
     * The Amazon S3 bucket where the Spot instance data feed is located.
     * 
     */
    private String bucket;
    /**
     * 
     * The prefix that is prepended to data feed files.
     * 
     */
    private String prefix;
    /**
     * 
     * The state of the Spot instance data feed subscription.
     * 
     */
    private String state;
    /**
     * 
     * The fault codes for the Spot instance request, if any.
     * 
     */
    private SpotInstanceStateFault fault;
    /**
     * 
     * The AWS account ID of the account.
     * 
     * 
     * @param ownerId
     *        The AWS account ID of the account.
     */
    public void setOwnerId(String ownerId) {
        this.ownerId = ownerId;
    }
    /**
     * 
     * The AWS account ID of the account.
     * 
     * 
     * @return The AWS account ID of the account.
     */
    public String getOwnerId() {
        return this.ownerId;
    }
    /**
     * 
     * The AWS account ID of the account.
     * 
     * 
     * @param ownerId
     *        The AWS account ID of the account.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public SpotDatafeedSubscription withOwnerId(String ownerId) {
        setOwnerId(ownerId);
        return this;
    }
    /**
     * 
     * The Amazon S3 bucket where the Spot instance data feed is located.
     * 
     * 
     * @param bucket
     *        The Amazon S3 bucket where the Spot instance data feed is located.
     */
    public void setBucket(String bucket) {
        this.bucket = bucket;
    }
    /**
     * 
     * The Amazon S3 bucket where the Spot instance data feed is located.
     * 
     * 
     * @return The Amazon S3 bucket where the Spot instance data feed is
     *         located.
     */
    public String getBucket() {
        return this.bucket;
    }
    /**
     * 
     * The Amazon S3 bucket where the Spot instance data feed is located.
     * 
     * 
     * @param bucket
     *        The Amazon S3 bucket where the Spot instance data feed is located.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public SpotDatafeedSubscription withBucket(String bucket) {
        setBucket(bucket);
        return this;
    }
    /**
     * 
     * The prefix that is prepended to data feed files.
     * 
     * 
     * @param prefix
     *        The prefix that is prepended to data feed files.
     */
    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }
    /**
     * 
     * The prefix that is prepended to data feed files.
     * 
     * 
     * @return The prefix that is prepended to data feed files.
     */
    public String getPrefix() {
        return this.prefix;
    }
    /**
     * 
     * The prefix that is prepended to data feed files.
     * 
     * 
     * @param prefix
     *        The prefix that is prepended to data feed files.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public SpotDatafeedSubscription withPrefix(String prefix) {
        setPrefix(prefix);
        return this;
    }
    /**
     * 
     * The state of the Spot instance data feed subscription.
     * 
     * 
     * @param state
     *        The state of the Spot instance data feed subscription.
     * @see DatafeedSubscriptionState
     */
    public void setState(String state) {
        this.state = state;
    }
    /**
     * 
     * The state of the Spot instance data feed subscription.
     * 
     * 
     * @return The state of the Spot instance data feed subscription.
     * @see DatafeedSubscriptionState
     */
    public String getState() {
        return this.state;
    }
    /**
     * 
     * The state of the Spot instance data feed subscription.
     * 
     * 
     * @param state
     *        The state of the Spot instance data feed subscription.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see DatafeedSubscriptionState
     */
    public SpotDatafeedSubscription withState(String state) {
        setState(state);
        return this;
    }
    /**
     * 
     * The state of the Spot instance data feed subscription.
     * 
     * 
     * @param state
     *        The state of the Spot instance data feed subscription.
     * @see DatafeedSubscriptionState
     */
    public void setState(DatafeedSubscriptionState state) {
        this.state = state.toString();
    }
    /**
     * 
     * The state of the Spot instance data feed subscription.
     * 
     * 
     * @param state
     *        The state of the Spot instance data feed subscription.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see DatafeedSubscriptionState
     */
    public SpotDatafeedSubscription withState(DatafeedSubscriptionState state) {
        setState(state);
        return this;
    }
    /**
     * 
     * The fault codes for the Spot instance request, if any.
     * 
     * 
     * @param fault
     *        The fault codes for the Spot instance request, if any.
     */
    public void setFault(SpotInstanceStateFault fault) {
        this.fault = fault;
    }
    /**
     * 
     * The fault codes for the Spot instance request, if any.
     * 
     * 
     * @return The fault codes for the Spot instance request, if any.
     */
    public SpotInstanceStateFault getFault() {
        return this.fault;
    }
    /**
     * 
     * The fault codes for the Spot instance request, if any.
     * 
     * 
     * @param fault
     *        The fault codes for the Spot instance request, if any.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public SpotDatafeedSubscription withFault(SpotInstanceStateFault fault) {
        setFault(fault);
        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 (getOwnerId() != null)
            sb.append("OwnerId: " + getOwnerId() + ",");
        if (getBucket() != null)
            sb.append("Bucket: " + getBucket() + ",");
        if (getPrefix() != null)
            sb.append("Prefix: " + getPrefix() + ",");
        if (getState() != null)
            sb.append("State: " + getState() + ",");
        if (getFault() != null)
            sb.append("Fault: " + getFault());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof SpotDatafeedSubscription == false)
            return false;
        SpotDatafeedSubscription other = (SpotDatafeedSubscription) obj;
        if (other.getOwnerId() == null ^ this.getOwnerId() == null)
            return false;
        if (other.getOwnerId() != null
                && other.getOwnerId().equals(this.getOwnerId()) == false)
            return false;
        if (other.getBucket() == null ^ this.getBucket() == null)
            return false;
        if (other.getBucket() != null
                && other.getBucket().equals(this.getBucket()) == false)
            return false;
        if (other.getPrefix() == null ^ this.getPrefix() == null)
            return false;
        if (other.getPrefix() != null
                && other.getPrefix().equals(this.getPrefix()) == false)
            return false;
        if (other.getState() == null ^ this.getState() == null)
            return false;
        if (other.getState() != null
                && other.getState().equals(this.getState()) == false)
            return false;
        if (other.getFault() == null ^ this.getFault() == null)
            return false;
        if (other.getFault() != null
                && other.getFault().equals(this.getFault()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime * hashCode
                + ((getOwnerId() == null) ? 0 : getOwnerId().hashCode());
        hashCode = prime * hashCode
                + ((getBucket() == null) ? 0 : getBucket().hashCode());
        hashCode = prime * hashCode
                + ((getPrefix() == null) ? 0 : getPrefix().hashCode());
        hashCode = prime * hashCode
                + ((getState() == null) ? 0 : getState().hashCode());
        hashCode = prime * hashCode
                + ((getFault() == null) ? 0 : getFault().hashCode());
        return hashCode;
    }
    @Override
    public SpotDatafeedSubscription clone() {
        try {
            return (SpotDatafeedSubscription) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}