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 AssociateAddress operation.

Associates an Elastic IP address with an instance or a network interface.

An Elastic IP address is for use in either the EC2-Classic platform or in a VPC. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide .

[EC2-Classic, VPC in an EC2-VPC-only account] If the Elastic IP address is already associated with a different instance, it is disassociated from that instance and associated with the specified instance.

[VPC in an EC2-Classic account] If you don't specify a private IP address, the Elastic IP address is associated with the primary IP address. If the Elastic IP address is already associated with a different instance or a network interface, you get an error unless you allow reassociation.

This is an idempotent operation. If you perform the operation more than once, Amazon EC2 doesn't return an error.

 
The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.
 
     private String instanceId;

    
The Elastic IP address. This is required for EC2-Classic.
 
     private String publicIp;

    
[EC2-VPC] The allocation ID. This is required for EC2-VPC.
 
     private String allocationId;

    
[EC2-VPC] The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.
 
     private String networkInterfaceId;

    
[EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.
 
     private String privateIpAddress;

    
[EC2-VPC] Allows an Elastic IP address that is already associated with an instance or network interface to be re-associated with the specified instance or network interface. Otherwise, the operation fails.

Default: false

 
     private Boolean allowReassociation;

    
Default constructor for a new AssociateAddressRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
    public AssociateAddressRequest() {}
    
    
Constructs a new AssociateAddressRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
instanceId The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.
publicIp The Elastic IP address. This is required for EC2-Classic.
    public AssociateAddressRequest(String instanceIdString publicIp) {
        setInstanceId(instanceId);
        setPublicIp(publicIp);
    }

    
The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.

Returns:
The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.
    public String getInstanceId() {
        return ;
    }
    
    
The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.

Parameters:
instanceId The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.
    public void setInstanceId(String instanceId) {
        this. = instanceId;
    }
    
    
The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.

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

Parameters:
instanceId The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AssociateAddressRequest withInstanceId(String instanceId) {
        this. = instanceId;
        return this;
    }

    
The Elastic IP address. This is required for EC2-Classic.

Returns:
The Elastic IP address. This is required for EC2-Classic.
    public String getPublicIp() {
        return ;
    }
    
    
The Elastic IP address. This is required for EC2-Classic.

Parameters:
publicIp The Elastic IP address. This is required for EC2-Classic.
    public void setPublicIp(String publicIp) {
        this. = publicIp;
    }
    
    
The Elastic IP address. This is required for EC2-Classic.

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

Parameters:
publicIp The Elastic IP address. This is required for EC2-Classic.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AssociateAddressRequest withPublicIp(String publicIp) {
        this. = publicIp;
        return this;
    }

    
[EC2-VPC] The allocation ID. This is required for EC2-VPC.

Returns:
[EC2-VPC] The allocation ID. This is required for EC2-VPC.
    public String getAllocationId() {
        return ;
    }
    
    
[EC2-VPC] The allocation ID. This is required for EC2-VPC.

Parameters:
allocationId [EC2-VPC] The allocation ID. This is required for EC2-VPC.
    public void setAllocationId(String allocationId) {
        this. = allocationId;
    }
    
    
[EC2-VPC] The allocation ID. This is required for EC2-VPC.

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

Parameters:
allocationId [EC2-VPC] The allocation ID. This is required for EC2-VPC.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AssociateAddressRequest withAllocationId(String allocationId) {
        this. = allocationId;
        return this;
    }

    
[EC2-VPC] The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.

Returns:
[EC2-VPC] The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.
    public String getNetworkInterfaceId() {
        return ;
    }
    
    
[EC2-VPC] The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.

Parameters:
networkInterfaceId [EC2-VPC] The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.
    public void setNetworkInterfaceId(String networkInterfaceId) {
        this. = networkInterfaceId;
    }
    
    
[EC2-VPC] The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.

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

Parameters:
networkInterfaceId [EC2-VPC] The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AssociateAddressRequest withNetworkInterfaceId(String networkInterfaceId) {
        this. = networkInterfaceId;
        return this;
    }

    
[EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.

Returns:
[EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.
    public String getPrivateIpAddress() {
        return ;
    }
    
    
[EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.

Parameters:
privateIpAddress [EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.
    public void setPrivateIpAddress(String privateIpAddress) {
        this. = privateIpAddress;
    }
    
    
[EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.

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

Parameters:
privateIpAddress [EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AssociateAddressRequest withPrivateIpAddress(String privateIpAddress) {
        this. = privateIpAddress;
        return this;
    }

    
[EC2-VPC] Allows an Elastic IP address that is already associated with an instance or network interface to be re-associated with the specified instance or network interface. Otherwise, the operation fails.

Default: false

Returns:
[EC2-VPC] Allows an Elastic IP address that is already associated with an instance or network interface to be re-associated with the specified instance or network interface. Otherwise, the operation fails.

Default: false

    public Boolean isAllowReassociation() {
        return ;
    }
    
    
[EC2-VPC] Allows an Elastic IP address that is already associated with an instance or network interface to be re-associated with the specified instance or network interface. Otherwise, the operation fails.

Default: false

Parameters:
allowReassociation [EC2-VPC] Allows an Elastic IP address that is already associated with an instance or network interface to be re-associated with the specified instance or network interface. Otherwise, the operation fails.

Default: false

    public void setAllowReassociation(Boolean allowReassociation) {
        this. = allowReassociation;
    }
    
    
[EC2-VPC] Allows an Elastic IP address that is already associated with an instance or network interface to be re-associated with the specified instance or network interface. Otherwise, the operation fails.

Default: false

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

Parameters:
allowReassociation [EC2-VPC] Allows an Elastic IP address that is already associated with an instance or network interface to be re-associated with the specified instance or network interface. Otherwise, the operation fails.

Default: false

Returns:
A reference to this updated object so that method calls can be chained together.
    public AssociateAddressRequest withAllowReassociation(Boolean allowReassociation) {
        this. = allowReassociation;
        return this;
    }

    
[EC2-VPC] Allows an Elastic IP address that is already associated with an instance or network interface to be re-associated with the specified instance or network interface. Otherwise, the operation fails.

Default: false

Returns:
[EC2-VPC] Allows an Elastic IP address that is already associated with an instance or network interface to be re-associated with the specified instance or network interface. Otherwise, the operation fails.

Default: false

    public Boolean getAllowReassociation() {
        return ;
    }

    
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run.
    @Override
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }
    
    
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 (getInstanceId() != nullsb.append("InstanceId: " + getInstanceId() + ",");
        if (getPublicIp() != nullsb.append("PublicIp: " + getPublicIp() + ",");
        if (getAllocationId() != nullsb.append("AllocationId: " + getAllocationId() + ",");
        if (getNetworkInterfaceId() != nullsb.append("NetworkInterfaceId: " + getNetworkInterfaceId() + ",");
        if (getPrivateIpAddress() != nullsb.append("PrivateIpAddress: " + getPrivateIpAddress() + ",");
        if (isAllowReassociation() != nullsb.append("AllowReassociation: " + isAllowReassociation() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode()); 
        hashCode = prime * hashCode + ((getPublicIp() == null) ? 0 : getPublicIp().hashCode()); 
        hashCode = prime * hashCode + ((getAllocationId() == null) ? 0 : getAllocationId().hashCode()); 
        hashCode = prime * hashCode + ((getNetworkInterfaceId() == null) ? 0 : getNetworkInterfaceId().hashCode()); 
        hashCode = prime * hashCode + ((getPrivateIpAddress() == null) ? 0 : getPrivateIpAddress().hashCode()); 
        hashCode = prime * hashCode + ((isAllowReassociation() == null) ? 0 : isAllowReassociation().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof AssociateAddressRequest == falsereturn false;
        AssociateAddressRequest other = (AssociateAddressRequest)obj;
        
        if (other.getInstanceId() == null ^ this.getInstanceId() == nullreturn false;
        if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == falsereturn false
        if (other.getPublicIp() == null ^ this.getPublicIp() == nullreturn false;
        if (other.getPublicIp() != null && other.getPublicIp().equals(this.getPublicIp()) == falsereturn false
        if (other.getAllocationId() == null ^ this.getAllocationId() == nullreturn false;
        if (other.getAllocationId() != null && other.getAllocationId().equals(this.getAllocationId()) == falsereturn false
        if (other.getNetworkInterfaceId() == null ^ this.getNetworkInterfaceId() == nullreturn false;
        if (other.getNetworkInterfaceId() != null && other.getNetworkInterfaceId().equals(this.getNetworkInterfaceId()) == falsereturn false
        if (other.getPrivateIpAddress() == null ^ this.getPrivateIpAddress() == nullreturn false;
        if (other.getPrivateIpAddress() != null && other.getPrivateIpAddress().equals(this.getPrivateIpAddress()) == falsereturn false
        if (other.isAllowReassociation() == null ^ this.isAllowReassociation() == nullreturn false;
        if (other.isAllowReassociation() != null && other.isAllowReassociation().equals(this.isAllowReassociation()) == falsereturn false
        return true;
    }
    
    @Override
    public AssociateAddressRequest clone() {
        
            return (AssociateAddressRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X