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;
 
 
Container for the parameters to the AssignPrivateIpAddresses operation.

Assigns one or more secondary private IP addresses to the specified network interface. You can specify one or more specific secondary IP addresses, or you can specify the number of secondary IP addresses to be automatically assigned within the subnet's CIDR block range. The number of secondary IP addresses that you can assign to an instance varies by instance type. For information about instance types, see Instance Types in the Amazon Elastic Compute Cloud User Guide . For more information about Elastic IP addresses, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide .

AssignPrivateIpAddresses is available only in EC2-VPC.

 
 public class AssignPrivateIpAddressesRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The ID of the network interface.
 
     private String networkInterfaceId;

    
One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

 
The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.
 
     private Integer secondaryPrivateIpAddressCount;

    
Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.
 
     private Boolean allowReassignment;

    
The ID of the network interface.

Returns:
The ID of the network interface.
 
     public String getNetworkInterfaceId() {
         return ;
     }
    
    
The ID of the network interface.

Parameters:
networkInterfaceId The ID of the network interface.
 
     public void setNetworkInterfaceId(String networkInterfaceId) {
         this. = networkInterfaceId;
     }
    
    
The ID of the network interface.

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

Parameters:
networkInterfaceId The ID of the network interface.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public AssignPrivateIpAddressesRequest withNetworkInterfaceId(String networkInterfaceId) {
         this. = networkInterfaceId;
         return this;
    }

    
One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

Returns:
One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

Parameters:
privateIpAddresses One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

    public void setPrivateIpAddresses(java.util.Collection<StringprivateIpAddresses) {
        if (privateIpAddresses == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<StringprivateIpAddressesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(privateIpAddresses.size());
        privateIpAddressesCopy.addAll(privateIpAddresses);
        this. = privateIpAddressesCopy;
    }
    
    
One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

NOTE: This method appends the values to the existing list (if any). Use setPrivateIpAddresses(java.util.Collection) or withPrivateIpAddresses(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:
privateIpAddresses One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

Returns:
A reference to this updated object so that method calls can be chained together.
    public AssignPrivateIpAddressesRequest withPrivateIpAddresses(String... privateIpAddresses) {
        if (getPrivateIpAddresses() == nullsetPrivateIpAddresses(new java.util.ArrayList<String>(privateIpAddresses.length));
        for (String value : privateIpAddresses) {
            getPrivateIpAddresses().add(value);
        }
        return this;
    }
    
    
One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

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

Parameters:
privateIpAddresses One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

Returns:
A reference to this updated object so that method calls can be chained together.
        if (privateIpAddresses == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringprivateIpAddressesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(privateIpAddresses.size());
            privateIpAddressesCopy.addAll(privateIpAddresses);
            this. = privateIpAddressesCopy;
        }
        return this;
    }

    
The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.

Returns:
The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.
        return ;
    }
    
    
The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.

Parameters:
secondaryPrivateIpAddressCount The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.
    public void setSecondaryPrivateIpAddressCount(Integer secondaryPrivateIpAddressCount) {
        this. = secondaryPrivateIpAddressCount;
    }
    
    
The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.

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

Parameters:
secondaryPrivateIpAddressCount The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AssignPrivateIpAddressesRequest withSecondaryPrivateIpAddressCount(Integer secondaryPrivateIpAddressCount) {
        this. = secondaryPrivateIpAddressCount;
        return this;
    }

    
Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.

Returns:
Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.
    public Boolean isAllowReassignment() {
        return ;
    }
    
    
Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.

Parameters:
allowReassignment Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.
    public void setAllowReassignment(Boolean allowReassignment) {
        this. = allowReassignment;
    }
    
    
Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.

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

Parameters:
allowReassignment Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AssignPrivateIpAddressesRequest withAllowReassignment(Boolean allowReassignment) {
        this. = allowReassignment;
        return this;
    }

    
Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.

Returns:
Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.
    public Boolean getAllowReassignment() {
        return ;
    }

    
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 (getNetworkInterfaceId() != nullsb.append("NetworkInterfaceId: " + getNetworkInterfaceId() + ",");
        if (getPrivateIpAddresses() != nullsb.append("PrivateIpAddresses: " + getPrivateIpAddresses() + ",");
        if (getSecondaryPrivateIpAddressCount() != nullsb.append("SecondaryPrivateIpAddressCount: " + getSecondaryPrivateIpAddressCount() + ",");
        if (isAllowReassignment() != nullsb.append("AllowReassignment: " + isAllowReassignment() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getNetworkInterfaceId() == null) ? 0 : getNetworkInterfaceId().hashCode()); 
        hashCode = prime * hashCode + ((getPrivateIpAddresses() == null) ? 0 : getPrivateIpAddresses().hashCode()); 
        hashCode = prime * hashCode + ((getSecondaryPrivateIpAddressCount() == null) ? 0 : getSecondaryPrivateIpAddressCount().hashCode()); 
        hashCode = prime * hashCode + ((isAllowReassignment() == null) ? 0 : isAllowReassignment().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof AssignPrivateIpAddressesRequest == falsereturn false;
        
        if (other.getNetworkInterfaceId() == null ^ this.getNetworkInterfaceId() == nullreturn false;
        if (other.getNetworkInterfaceId() != null && other.getNetworkInterfaceId().equals(this.getNetworkInterfaceId()) == falsereturn false
        if (other.getPrivateIpAddresses() == null ^ this.getPrivateIpAddresses() == nullreturn false;
        if (other.getPrivateIpAddresses() != null && other.getPrivateIpAddresses().equals(this.getPrivateIpAddresses()) == falsereturn false
        if (other.getSecondaryPrivateIpAddressCount() == null ^ this.getSecondaryPrivateIpAddressCount() == nullreturn false;
        if (other.getSecondaryPrivateIpAddressCount() != null && other.getSecondaryPrivateIpAddressCount().equals(this.getSecondaryPrivateIpAddressCount()) == falsereturn false
        if (other.isAllowReassignment() == null ^ this.isAllowReassignment() == nullreturn false;
        if (other.isAllowReassignment() != null && other.isAllowReassignment().equals(this.isAllowReassignment()) == falsereturn false
        return true;
    }
    
    @Override
        
            return (AssignPrivateIpAddressesRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X