Start line:  
End line:  

Snippet Preview

Snippet HTML Code

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

An Amazon EC2 reservation of requested EC2 instances.

 
 public class Reservation {

    
The unique ID of this reservation.
 
     private String reservationId;

    
The AWS Access Key ID of the user who owns the reservation.
 
     private String ownerId;

    
The unique ID of the user who requested the instances in this reservation.
 
     private String requesterId;

    
The list of security groups requested for the instances in this reservation.
 
     private java.util.List<StringgroupNames;

    
The list of Amazon EC2 instances included in this reservation.
 
     private java.util.List<Instanceinstances;

    
The unique ID of this reservation.

Returns:
The unique ID of this reservation.
 
     public String getReservationId() {
         return ;
     }
    
    
The unique ID of this reservation.

Parameters:
reservationId The unique ID of this reservation.
 
     public void setReservationId(String reservationId) {
         this. = reservationId;
     }
    
    
The unique ID of this reservation.

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

Parameters:
reservationId The unique ID of this reservation.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public Reservation withReservationId(String reservationId) {
         this. = reservationId;
         return this;
     }
    
    
    
The AWS Access Key ID of the user who owns the reservation.

Returns:
The AWS Access Key ID of the user who owns the reservation.
 
     public String getOwnerId() {
         return ;
     }
    
    
The AWS Access Key ID of the user who owns the reservation.

Parameters:
ownerId The AWS Access Key ID of the user who owns the reservation.
 
     public void setOwnerId(String ownerId) {
        this. = ownerId;
    }
    
    
The AWS Access Key ID of the user who owns the reservation.

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

Parameters:
ownerId The AWS Access Key ID of the user who owns the reservation.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Reservation withOwnerId(String ownerId) {
        this. = ownerId;
        return this;
    }
    
    
    
The unique ID of the user who requested the instances in this reservation.

Returns:
The unique ID of the user who requested the instances in this reservation.
    public String getRequesterId() {
        return ;
    }
    
    
The unique ID of the user who requested the instances in this reservation.

Parameters:
requesterId The unique ID of the user who requested the instances in this reservation.
    public void setRequesterId(String requesterId) {
        this. = requesterId;
    }
    
    
The unique ID of the user who requested the instances in this reservation.

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

Parameters:
requesterId The unique ID of the user who requested the instances in this reservation.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Reservation withRequesterId(String requesterId) {
        this. = requesterId;
        return this;
    }
    
    
    
The list of security groups requested for the instances in this reservation.

Returns:
The list of security groups requested for the instances in this reservation.
    public java.util.List<StringgetGroupNames() {
        if ( == null) {
             = new java.util.ArrayList<String>();
        }
        return ;
    }
    
    
The list of security groups requested for the instances in this reservation.

Parameters:
groupNames The list of security groups requested for the instances in this reservation.
    public void setGroupNames(java.util.Collection<StringgroupNames) {
        java.util.List<StringgroupNamesCopy = new java.util.ArrayList<String>();
        if (groupNames != null) {
            groupNamesCopy.addAll(groupNames);
        }
        this. = groupNamesCopy;
    }
    
    
The list of security groups requested for the instances in this reservation.

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

Parameters:
groupNames The list of security groups requested for the instances in this reservation.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Reservation withGroupNames(String... groupNames) {
        for (String value : groupNames) {
            getGroupNames().add(value);
        }
        return this;
    }
    
    
The list of security groups requested for the instances in this reservation.

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

Parameters:
groupNames The list of security groups requested for the instances in this reservation.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Reservation withGroupNames(java.util.Collection<StringgroupNames) {
        java.util.List<StringgroupNamesCopy = new java.util.ArrayList<String>();
        if (groupNames != null) {
            groupNamesCopy.addAll(groupNames);
        }
        this. = groupNamesCopy;
        return this;
    }
    
    
The list of Amazon EC2 instances included in this reservation.

Returns:
The list of Amazon EC2 instances included in this reservation.
    public java.util.List<InstancegetInstances() {
        if ( == null) {
             = new java.util.ArrayList<Instance>();
        }
        return ;
    }
    
    
The list of Amazon EC2 instances included in this reservation.

Parameters:
instances The list of Amazon EC2 instances included in this reservation.
    public void setInstances(java.util.Collection<Instanceinstances) {
        java.util.List<InstanceinstancesCopy = new java.util.ArrayList<Instance>();
        if (instances != null) {
            instancesCopy.addAll(instances);
        }
        this. = instancesCopy;
    }
    
    
The list of Amazon EC2 instances included in this reservation.

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

Parameters:
instances The list of Amazon EC2 instances included in this reservation.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Reservation withInstances(Instance... instances) {
        for (Instance value : instances) {
            getInstances().add(value);
        }
        return this;
    }
    
    
The list of Amazon EC2 instances included in this reservation.

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

Parameters:
instances The list of Amazon EC2 instances included in this reservation.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Reservation withInstances(java.util.Collection<Instanceinstances) {
        java.util.List<InstanceinstancesCopy = new java.util.ArrayList<Instance>();
        if (instances != null) {
            instancesCopy.addAll(instances);
        }
        this. = instancesCopy;
        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("{");
        sb.append("ReservationId: " +  + ", ");
        sb.append("OwnerId: " +  + ", ");
        sb.append("RequesterId: " +  + ", ");
        sb.append("GroupNames: " +  + ", ");
        sb.append("Instances: " +  + ", ");
        sb.append("}");
        return sb.toString();
    }
    
}
    
New to GrepCode? Check out our FAQ X