public class AssociateAddressRequest extends AmazonWebServiceRequest implements java.io.Serializable, DryRunSupportedRequest<AssociateAddressRequest>
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.
Constructor and Description |
---|
AssociateAddressRequest()
Default constructor for a new AssociateAddressRequest object.
|
AssociateAddressRequest(java.lang.String instanceId,
java.lang.String publicIp)
Constructs a new AssociateAddressRequest object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getAllocationId()
[EC2-VPC] The allocation ID.
|
java.lang.Boolean |
getAllowReassociation()
[EC2-VPC] For a VPC in an EC2-Classic account, specify true to allow
an Elastic IP address that is already associated with an instance or
network interface to be reassociated with the specified instance or
network interface.
|
Request<AssociateAddressRequest> |
getDryRunRequest()
This method is intended for internal use only.
|
java.lang.String |
getInstanceId()
The ID of the instance.
|
java.lang.String |
getNetworkInterfaceId()
[EC2-VPC] The ID of the network interface.
|
java.lang.String |
getPrivateIpAddress()
[EC2-VPC] The primary or secondary private IP address to associate
with the Elastic IP address.
|
java.lang.String |
getPublicIp()
The Elastic IP address.
|
int |
hashCode() |
java.lang.Boolean |
isAllowReassociation()
[EC2-VPC] For a VPC in an EC2-Classic account, specify true to allow
an Elastic IP address that is already associated with an instance or
network interface to be reassociated with the specified instance or
network interface.
|
void |
setAllocationId(java.lang.String allocationId)
[EC2-VPC] The allocation ID.
|
void |
setAllowReassociation(java.lang.Boolean allowReassociation)
[EC2-VPC] For a VPC in an EC2-Classic account, specify true to allow
an Elastic IP address that is already associated with an instance or
network interface to be reassociated with the specified instance or
network interface.
|
void |
setInstanceId(java.lang.String instanceId)
The ID of the instance.
|
void |
setNetworkInterfaceId(java.lang.String networkInterfaceId)
[EC2-VPC] The ID of the network interface.
|
void |
setPrivateIpAddress(java.lang.String privateIpAddress)
[EC2-VPC] The primary or secondary private IP address to associate
with the Elastic IP address.
|
void |
setPublicIp(java.lang.String publicIp)
The Elastic IP address.
|
java.lang.String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
AssociateAddressRequest |
withAllocationId(java.lang.String allocationId)
[EC2-VPC] The allocation ID.
|
AssociateAddressRequest |
withAllowReassociation(java.lang.Boolean allowReassociation)
[EC2-VPC] For a VPC in an EC2-Classic account, specify true to allow
an Elastic IP address that is already associated with an instance or
network interface to be reassociated with the specified instance or
network interface.
|
AssociateAddressRequest |
withInstanceId(java.lang.String instanceId)
The ID of the instance.
|
AssociateAddressRequest |
withNetworkInterfaceId(java.lang.String networkInterfaceId)
[EC2-VPC] The ID of the network interface.
|
AssociateAddressRequest |
withPrivateIpAddress(java.lang.String privateIpAddress)
[EC2-VPC] The primary or secondary private IP address to associate
with the Elastic IP address.
|
AssociateAddressRequest |
withPublicIp(java.lang.String publicIp)
The Elastic IP address.
|
clone, getCloneRoot, getCloneSource, getGeneralProgressListener, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public AssociateAddressRequest()
public AssociateAddressRequest(java.lang.String instanceId, java.lang.String publicIp)
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 java.lang.String getInstanceId()
public void setInstanceId(java.lang.String instanceId)
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 AssociateAddressRequest withInstanceId(java.lang.String instanceId)
Returns a reference to this object so that method calls can be chained together.
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 java.lang.String getPublicIp()
public void setPublicIp(java.lang.String publicIp)
publicIp
- The Elastic IP address. This is required for EC2-Classic.public AssociateAddressRequest withPublicIp(java.lang.String publicIp)
Returns a reference to this object so that method calls can be chained together.
publicIp
- The Elastic IP address. This is required for EC2-Classic.public java.lang.String getAllocationId()
public void setAllocationId(java.lang.String allocationId)
allocationId
- [EC2-VPC] The allocation ID. This is required for EC2-VPC.public AssociateAddressRequest withAllocationId(java.lang.String allocationId)
Returns a reference to this object so that method calls can be chained together.
allocationId
- [EC2-VPC] The allocation ID. This is required for EC2-VPC.public java.lang.String getNetworkInterfaceId()
public void setNetworkInterfaceId(java.lang.String networkInterfaceId)
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 AssociateAddressRequest withNetworkInterfaceId(java.lang.String networkInterfaceId)
Returns a reference to this object so that method calls can be chained together.
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 java.lang.String getPrivateIpAddress()
public void setPrivateIpAddress(java.lang.String privateIpAddress)
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 AssociateAddressRequest withPrivateIpAddress(java.lang.String privateIpAddress)
Returns a reference to this object so that method calls can be chained together.
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 java.lang.Boolean isAllowReassociation()
public void setAllowReassociation(java.lang.Boolean allowReassociation)
allowReassociation
- [EC2-VPC] For a VPC in an EC2-Classic account, specify true to allow
an Elastic IP address that is already associated with an instance or
network interface to be reassociated with the specified instance or
network interface. Otherwise, the operation fails. In a VPC in an
EC2-VPC-only account, reassociation is automatic, therefore you can
specify false to ensure the operation fails if the Elastic IP address
is already associated with another resource.public AssociateAddressRequest withAllowReassociation(java.lang.Boolean allowReassociation)
Returns a reference to this object so that method calls can be chained together.
allowReassociation
- [EC2-VPC] For a VPC in an EC2-Classic account, specify true to allow
an Elastic IP address that is already associated with an instance or
network interface to be reassociated with the specified instance or
network interface. Otherwise, the operation fails. In a VPC in an
EC2-VPC-only account, reassociation is automatic, therefore you can
specify false to ensure the operation fails if the Elastic IP address
is already associated with another resource.public java.lang.Boolean getAllowReassociation()
public Request<AssociateAddressRequest> getDryRunRequest()
getDryRunRequest
in interface DryRunSupportedRequest<AssociateAddressRequest>
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.