Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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;
 

Describes a Reserved Instance listing.

 
 public class ReservedInstancesListing implements SerializableCloneable {

    
The ID of the Reserved Instance listing.
 
     private String reservedInstancesListingId;

    
The ID of the Reserved Instance.
 
     private String reservedInstancesId;

    
The time the listing was created.
 
     private java.util.Date createDate;

    
The last modified timestamp of the listing.
 
     private java.util.Date updateDate;

    
The status of the Reserved Instance listing.

Constraints:
Allowed Values: active, pending, cancelled, closed

 
     private String status;

    
The reason for the current status of the Reserved Instance listing. The response can be blank.
 
     private String statusMessage;

    
The number of instances in this state.
 
The price of the Reserved Instance listing.
 
Any tags assigned to the resource.
 
A unique, case-sensitive key supplied by the client to ensure that the request is idempotent. For more information, see Ensuring Idempotency.
 
     private String clientToken;

    
The ID of the Reserved Instance listing.

Returns:
The ID of the Reserved Instance listing.
 
     public String getReservedInstancesListingId() {
         return ;
     }
    
    
The ID of the Reserved Instance listing.

Parameters:
reservedInstancesListingId The ID of the Reserved Instance listing.
 
     public void setReservedInstancesListingId(String reservedInstancesListingId) {
         this. = reservedInstancesListingId;
     }
    
    
The ID of the Reserved Instance listing.

Returns a reference to this object so that method calls can be chained together.

Parameters:
reservedInstancesListingId The ID of the Reserved Instance listing.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ReservedInstancesListing withReservedInstancesListingId(String reservedInstancesListingId) {
        this. = reservedInstancesListingId;
        return this;
    }

    
The ID of the Reserved Instance.

Returns:
The ID of the Reserved Instance.
    public String getReservedInstancesId() {
        return ;
    }
    
    
The ID of the Reserved Instance.

Parameters:
reservedInstancesId The ID of the Reserved Instance.
    public void setReservedInstancesId(String reservedInstancesId) {
        this. = reservedInstancesId;
    }
    
    
The ID of the Reserved Instance.

Returns a reference to this object so that method calls can be chained together.

Parameters:
reservedInstancesId The ID of the Reserved Instance.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ReservedInstancesListing withReservedInstancesId(String reservedInstancesId) {
        this. = reservedInstancesId;
        return this;
    }

    
The time the listing was created.

Returns:
The time the listing was created.
    public java.util.Date getCreateDate() {
        return ;
    }
    
    
The time the listing was created.

Parameters:
createDate The time the listing was created.
    public void setCreateDate(java.util.Date createDate) {
        this. = createDate;
    }
    
    
The time the listing was created.

Returns a reference to this object so that method calls can be chained together.

Parameters:
createDate The time the listing was created.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ReservedInstancesListing withCreateDate(java.util.Date createDate) {
        this. = createDate;
        return this;
    }

    
The last modified timestamp of the listing.

Returns:
The last modified timestamp of the listing.
    public java.util.Date getUpdateDate() {
        return ;
    }
    
    
The last modified timestamp of the listing.

Parameters:
updateDate The last modified timestamp of the listing.
    public void setUpdateDate(java.util.Date updateDate) {
        this. = updateDate;
    }
    
    
The last modified timestamp of the listing.

Returns a reference to this object so that method calls can be chained together.

Parameters:
updateDate The last modified timestamp of the listing.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ReservedInstancesListing withUpdateDate(java.util.Date updateDate) {
        this. = updateDate;
        return this;
    }

    
The status of the Reserved Instance listing.

Constraints:
Allowed Values: active, pending, cancelled, closed

Returns:
The status of the Reserved Instance listing.
See also:
ListingStatus
    public String getStatus() {
        return ;
    }
    
    
The status of the Reserved Instance listing.

Constraints:
Allowed Values: active, pending, cancelled, closed

Parameters:
status The status of the Reserved Instance listing.
See also:
ListingStatus
    public void setStatus(String status) {
        this. = status;
    }
    
    
The status of the Reserved Instance listing.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: active, pending, cancelled, closed

Parameters:
status The status of the Reserved Instance listing.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
ListingStatus
    public ReservedInstancesListing withStatus(String status) {
        this. = status;
        return this;
    }

    
The status of the Reserved Instance listing.

Constraints:
Allowed Values: active, pending, cancelled, closed

Parameters:
status The status of the Reserved Instance listing.
See also:
ListingStatus
    public void setStatus(ListingStatus status) {
        this. = status.toString();
    }
    
    
The status of the Reserved Instance listing.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: active, pending, cancelled, closed

Parameters:
status The status of the Reserved Instance listing.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
ListingStatus
        this. = status.toString();
        return this;
    }

    
The reason for the current status of the Reserved Instance listing. The response can be blank.

Returns:
The reason for the current status of the Reserved Instance listing. The response can be blank.
    public String getStatusMessage() {
        return ;
    }
    
    
The reason for the current status of the Reserved Instance listing. The response can be blank.

Parameters:
statusMessage The reason for the current status of the Reserved Instance listing. The response can be blank.
    public void setStatusMessage(String statusMessage) {
        this. = statusMessage;
    }
    
    
The reason for the current status of the Reserved Instance listing. The response can be blank.

Returns a reference to this object so that method calls can be chained together.

Parameters:
statusMessage The reason for the current status of the Reserved Instance listing. The response can be blank.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ReservedInstancesListing withStatusMessage(String statusMessage) {
        this. = statusMessage;
        return this;
    }

    
The number of instances in this state.

Returns:
The number of instances in this state.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The number of instances in this state.

Parameters:
instanceCounts The number of instances in this state.
    public void setInstanceCounts(java.util.Collection<InstanceCountinstanceCounts) {
        if (instanceCounts == null) {
            this. = null;
            return;
        }
        instanceCountsCopy.addAll(instanceCounts);
        this. = instanceCountsCopy;
    }
    
    
The number of instances in this state.

NOTE: This method appends the values to the existing list (if any). Use setInstanceCounts(java.util.Collection) or withInstanceCounts(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
instanceCounts The number of instances in this state.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ReservedInstancesListing withInstanceCounts(InstanceCount... instanceCounts) {
        if (getInstanceCounts() == nullsetInstanceCounts(new java.util.ArrayList<InstanceCount>(instanceCounts.length));
        for (InstanceCount value : instanceCounts) {
            getInstanceCounts().add(value);
        }
        return this;
    }
    
    
The number of instances in this state.

Returns a reference to this object so that method calls can be chained together.

Parameters:
instanceCounts The number of instances in this state.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (instanceCounts == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<InstanceCountinstanceCountsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<InstanceCount>(instanceCounts.size());
            instanceCountsCopy.addAll(instanceCounts);
            this. = instanceCountsCopy;
        }
        return this;
    }

    
The price of the Reserved Instance listing.

Returns:
The price of the Reserved Instance listing.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The price of the Reserved Instance listing.

Parameters:
priceSchedules The price of the Reserved Instance listing.
    public void setPriceSchedules(java.util.Collection<PriceSchedulepriceSchedules) {
        if (priceSchedules == null) {
            this. = null;
            return;
        }
        priceSchedulesCopy.addAll(priceSchedules);
        this. = priceSchedulesCopy;
    }
    
    
The price of the Reserved Instance listing.

NOTE: This method appends the values to the existing list (if any). Use setPriceSchedules(java.util.Collection) or withPriceSchedules(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
priceSchedules The price of the Reserved Instance listing.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ReservedInstancesListing withPriceSchedules(PriceSchedule... priceSchedules) {
        if (getPriceSchedules() == nullsetPriceSchedules(new java.util.ArrayList<PriceSchedule>(priceSchedules.length));
        for (PriceSchedule value : priceSchedules) {
            getPriceSchedules().add(value);
        }
        return this;
    }
    
    
The price of the Reserved Instance listing.

Returns a reference to this object so that method calls can be chained together.

Parameters:
priceSchedules The price of the Reserved Instance listing.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (priceSchedules == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<PriceSchedulepriceSchedulesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<PriceSchedule>(priceSchedules.size());
            priceSchedulesCopy.addAll(priceSchedules);
            this. = priceSchedulesCopy;
        }
        return this;
    }

    
Any tags assigned to the resource.

Returns:
Any tags assigned to the resource.
    public java.util.List<TaggetTags() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<Tag>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
Any tags assigned to the resource.

Parameters:
tags Any tags assigned to the resource.
    public void setTags(java.util.Collection<Tagtags) {
        if (tags == null) {
            this. = null;
            return;
        }
        tagsCopy.addAll(tags);
        this. = tagsCopy;
    }
    
    
Any tags assigned to the resource.

NOTE: This method appends the values to the existing list (if any). Use setTags(java.util.Collection) or withTags(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
tags Any tags assigned to the resource.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ReservedInstancesListing withTags(Tag... tags) {
        if (getTags() == nullsetTags(new java.util.ArrayList<Tag>(tags.length));
        for (Tag value : tags) {
            getTags().add(value);
        }
        return this;
    }
    
    
Any tags assigned to the resource.

Returns a reference to this object so that method calls can be chained together.

Parameters:
tags Any tags assigned to the resource.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (tags == null) {
            this. = null;
        } else {
            tagsCopy.addAll(tags);
            this. = tagsCopy;
        }
        return this;
    }

    
A unique, case-sensitive key supplied by the client to ensure that the request is idempotent. For more information, see Ensuring Idempotency.

Returns:
A unique, case-sensitive key supplied by the client to ensure that the request is idempotent. For more information, see Ensuring Idempotency.
    public String getClientToken() {
        return ;
    }
    
    
A unique, case-sensitive key supplied by the client to ensure that the request is idempotent. For more information, see Ensuring Idempotency.

Parameters:
clientToken A unique, case-sensitive key supplied by the client to ensure that the request is idempotent. For more information, see Ensuring Idempotency.
    public void setClientToken(String clientToken) {
        this. = clientToken;
    }
    
    
A unique, case-sensitive key supplied by the client to ensure that the request is idempotent. For more information, see Ensuring Idempotency.

Returns a reference to this object so that method calls can be chained together.

Parameters:
clientToken A unique, case-sensitive key supplied by the client to ensure that the request is idempotent. For more information, see Ensuring Idempotency.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ReservedInstancesListing withClientToken(String clientToken) {
        this. = clientToken;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getReservedInstancesListingId() != nullsb.append("ReservedInstancesListingId: " + getReservedInstancesListingId() + ",");
        if (getReservedInstancesId() != nullsb.append("ReservedInstancesId: " + getReservedInstancesId() + ",");
        if (getCreateDate() != nullsb.append("CreateDate: " + getCreateDate() + ",");
        if (getUpdateDate() != nullsb.append("UpdateDate: " + getUpdateDate() + ",");
        if (getStatus() != nullsb.append("Status: " + getStatus() + ",");
        if (getStatusMessage() != nullsb.append("StatusMessage: " + getStatusMessage() + ",");
        if (getInstanceCounts() != nullsb.append("InstanceCounts: " + getInstanceCounts() + ",");
        if (getPriceSchedules() != nullsb.append("PriceSchedules: " + getPriceSchedules() + ",");
        if (getTags() != nullsb.append("Tags: " + getTags() + ",");
        if (getClientToken() != nullsb.append("ClientToken: " + getClientToken() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getReservedInstancesListingId() == null) ? 0 : getReservedInstancesListingId().hashCode()); 
        hashCode = prime * hashCode + ((getReservedInstancesId() == null) ? 0 : getReservedInstancesId().hashCode()); 
        hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode()); 
        hashCode = prime * hashCode + ((getUpdateDate() == null) ? 0 : getUpdateDate().hashCode()); 
        hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); 
        hashCode = prime * hashCode + ((getStatusMessage() == null) ? 0 : getStatusMessage().hashCode()); 
        hashCode = prime * hashCode + ((getInstanceCounts() == null) ? 0 : getInstanceCounts().hashCode()); 
        hashCode = prime * hashCode + ((getPriceSchedules() == null) ? 0 : getPriceSchedules().hashCode()); 
        hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); 
        hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof ReservedInstancesListing == falsereturn false;
        ReservedInstancesListing other = (ReservedInstancesListing)obj;
        
        if (other.getReservedInstancesListingId() == null ^ this.getReservedInstancesListingId() == nullreturn false;
        if (other.getReservedInstancesListingId() != null && other.getReservedInstancesListingId().equals(this.getReservedInstancesListingId()) == falsereturn false
        if (other.getReservedInstancesId() == null ^ this.getReservedInstancesId() == nullreturn false;
        if (other.getReservedInstancesId() != null && other.getReservedInstancesId().equals(this.getReservedInstancesId()) == falsereturn false
        if (other.getCreateDate() == null ^ this.getCreateDate() == nullreturn false;
        if (other.getCreateDate() != null && other.getCreateDate().equals(this.getCreateDate()) == falsereturn false
        if (other.getUpdateDate() == null ^ this.getUpdateDate() == nullreturn false;
        if (other.getUpdateDate() != null && other.getUpdateDate().equals(this.getUpdateDate()) == falsereturn false
        if (other.getStatus() == null ^ this.getStatus() == nullreturn false;
        if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == falsereturn false
        if (other.getStatusMessage() == null ^ this.getStatusMessage() == nullreturn false;
        if (other.getStatusMessage() != null && other.getStatusMessage().equals(this.getStatusMessage()) == falsereturn false
        if (other.getInstanceCounts() == null ^ this.getInstanceCounts() == nullreturn false;
        if (other.getInstanceCounts() != null && other.getInstanceCounts().equals(this.getInstanceCounts()) == falsereturn false
        if (other.getPriceSchedules() == null ^ this.getPriceSchedules() == nullreturn false;
        if (other.getPriceSchedules() != null && other.getPriceSchedules().equals(this.getPriceSchedules()) == falsereturn false
        if (other.getTags() == null ^ this.getTags() == nullreturn false;
        if (other.getTags() != null && other.getTags().equals(this.getTags()) == falsereturn false
        if (other.getClientToken() == null ^ this.getClientToken() == nullreturn false;
        if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == falsereturn false
        return true;
    }
    
    @Override
    public ReservedInstancesListing clone() {
        try {
            return (ReservedInstancesListingsuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X