/* * Copyright 2010-2018 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; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.AssociateAddressRequestMarshaller; /** * Container for the parameters to the {@link com.amazonaws.services.ec2.AmazonEC2#associateAddress(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. *
* * @see com.amazonaws.services.ec2.AmazonEC2#associateAddress(AssociateAddressRequest) */ public class AssociateAddressRequest extends AmazonWebServiceRequest implements Serializable, DryRunSupportedRequest* Returns a reference to this object so that method calls can be chained together. * * @param 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. * * @return A reference to this updated object so that method calls can be chained * together. */ public AssociateAddressRequest withInstanceId(String instanceId) { this.instanceId = instanceId; return this; } /** * The Elastic IP address. This is required for EC2-Classic. * * @return The Elastic IP address. This is required for EC2-Classic. */ public String getPublicIp() { return publicIp; } /** * The Elastic IP address. This is required for EC2-Classic. * * @param publicIp The Elastic IP address. This is required for EC2-Classic. */ public void setPublicIp(String publicIp) { this.publicIp = 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. * * @param publicIp The Elastic IP address. This is required for EC2-Classic. * * @return A reference to this updated object so that method calls can be chained * together. */ public AssociateAddressRequest withPublicIp(String publicIp) { this.publicIp = publicIp; return this; } /** * [EC2-VPC] The allocation ID. This is required for EC2-VPC. * * @return [EC2-VPC] The allocation ID. This is required for EC2-VPC. */ public String getAllocationId() { return allocationId; } /** * [EC2-VPC] The allocation ID. This is required for EC2-VPC. * * @param allocationId [EC2-VPC] The allocation ID. This is required for EC2-VPC. */ public void setAllocationId(String allocationId) { this.allocationId = 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. * * @param allocationId [EC2-VPC] The allocation ID. This is required for EC2-VPC. * * @return A reference to this updated object so that method calls can be chained * together. */ public AssociateAddressRequest withAllocationId(String allocationId) { this.allocationId = 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. * * @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. */ public String getNetworkInterfaceId() { return 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. * * @param 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 = 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. * * @param 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. * * @return A reference to this updated object so that method calls can be chained * together. */ public AssociateAddressRequest withNetworkInterfaceId(String networkInterfaceId) { this.networkInterfaceId = 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. * * @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. */ public String getPrivateIpAddress() { return 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. * * @param 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 = 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. * * @param 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. * * @return A reference to this updated object so that method calls can be chained * together. */ public AssociateAddressRequest withPrivateIpAddress(String privateIpAddress) { this.privateIpAddress = privateIpAddress; return this; } /** * [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. * * @return [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 Boolean isAllowReassociation() { return 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. * * @param 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 void setAllowReassociation(Boolean allowReassociation) { this.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. *
* Returns a reference to this object so that method calls can be chained together.
*
* @param 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.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public AssociateAddressRequest withAllowReassociation(Boolean allowReassociation) {
this.allowReassociation = allowReassociation;
return this;
}
/**
* [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.
*
* @return [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 Boolean getAllowReassociation() {
return allowReassociation;
}
/**
* This method is intended for internal use only.
* Returns the marshaled request configured with additional parameters to
* enable operation dry-run.
*/
@Override
public Request