All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.ec2.model.AssociateAddressRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with Amazon EC2 Service

There is a newer version: 1.12.772
Show newest version
/*
 * Copyright 2018-2023 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 javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
import com.amazonaws.services.ec2.model.transform.AssociateAddressRequestMarshaller;

/**
 * 
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AssociateAddressRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest {

    /**
     * 

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

*/ private String allocationId; /** *

* The ID of the instance. The instance must have exactly one attached network interface. For EC2-VPC, you can * specify either the instance ID or the network interface ID, but not both. For EC2-Classic, you must specify an * instance ID and the instance must be in the running state. *

*/ private String instanceId; /** *

* [EC2-Classic] The Elastic IP address to associate with the instance. This is required for EC2-Classic. *

*/ private String publicIp; /** *

* [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. *

*/ private Boolean allowReassociation; /** *

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

*

* For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. *

*/ 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; /** * Default constructor for AssociateAddressRequest object. Callers should use the setter or fluent setter (with...) * methods to initialize the 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. * * @param instanceId * The ID of the instance. The instance must have exactly one attached network interface. For EC2-VPC, you * can specify either the instance ID or the network interface ID, but not both. For EC2-Classic, you must * specify an instance ID and the instance must be in the running state. * @param publicIp * [EC2-Classic] The Elastic IP address to associate with the instance. This is required for EC2-Classic. */ public AssociateAddressRequest(String instanceId, String publicIp) { setInstanceId(instanceId); setPublicIp(publicIp); } /** *

* [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. *

* * @return [EC2-VPC] The allocation ID. This is required for EC2-VPC. */ public String getAllocationId() { return this.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. * @return Returns a reference to this object so that method calls can be chained together. */ public AssociateAddressRequest withAllocationId(String allocationId) { setAllocationId(allocationId); return this; } /** *

* The ID of the instance. The instance must have exactly one attached network interface. For EC2-VPC, you can * specify either the instance ID or the network interface ID, but not both. For EC2-Classic, you must specify an * instance ID and the instance must be in the running state. *

* * @param instanceId * The ID of the instance. The instance must have exactly one attached network interface. For EC2-VPC, you * can specify either the instance ID or the network interface ID, but not both. For EC2-Classic, you must * specify an instance ID and the instance must be in the running state. */ public void setInstanceId(String instanceId) { this.instanceId = instanceId; } /** *

* The ID of the instance. The instance must have exactly one attached network interface. For EC2-VPC, you can * specify either the instance ID or the network interface ID, but not both. For EC2-Classic, you must specify an * instance ID and the instance must be in the running state. *

* * @return The ID of the instance. The instance must have exactly one attached network interface. For EC2-VPC, you * can specify either the instance ID or the network interface ID, but not both. For EC2-Classic, you must * specify an instance ID and the instance must be in the running state. */ public String getInstanceId() { return this.instanceId; } /** *

* The ID of the instance. The instance must have exactly one attached network interface. For EC2-VPC, you can * specify either the instance ID or the network interface ID, but not both. For EC2-Classic, you must specify an * instance ID and the instance must be in the running state. *

* * @param instanceId * The ID of the instance. The instance must have exactly one attached network interface. For EC2-VPC, you * can specify either the instance ID or the network interface ID, but not both. For EC2-Classic, you must * specify an instance ID and the instance must be in the running state. * @return Returns a reference to this object so that method calls can be chained together. */ public AssociateAddressRequest withInstanceId(String instanceId) { setInstanceId(instanceId); return this; } /** *

* [EC2-Classic] The Elastic IP address to associate with the instance. This is required for EC2-Classic. *

* * @param publicIp * [EC2-Classic] The Elastic IP address to associate with the instance. This is required for EC2-Classic. */ public void setPublicIp(String publicIp) { this.publicIp = publicIp; } /** *

* [EC2-Classic] The Elastic IP address to associate with the instance. This is required for EC2-Classic. *

* * @return [EC2-Classic] The Elastic IP address to associate with the instance. This is required for EC2-Classic. */ public String getPublicIp() { return this.publicIp; } /** *

* [EC2-Classic] The Elastic IP address to associate with the instance. This is required for EC2-Classic. *

* * @param publicIp * [EC2-Classic] The Elastic IP address to associate with the instance. This is required for EC2-Classic. * @return Returns a reference to this object so that method calls can be chained together. */ public AssociateAddressRequest withPublicIp(String publicIp) { setPublicIp(publicIp); 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. *

* * @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. *

* * @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 this.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. * @return Returns a reference to this object so that method calls can be chained together. */ public AssociateAddressRequest withAllowReassociation(Boolean allowReassociation) { setAllowReassociation(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 isAllowReassociation() { return this.allowReassociation; } /** *

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

*

* For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. *

* * @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.

*

* For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. */ 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. *

*

* For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. *

* * @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.

*

* For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. */ public String getNetworkInterfaceId() { return 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. *

*

* For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. *

* * @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.

*

* For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. * @return Returns a reference to this object so that method calls can be chained together. */ public AssociateAddressRequest withNetworkInterfaceId(String networkInterfaceId) { setNetworkInterfaceId(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. *

* * @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. *

* * @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 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. *

* * @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 Returns a reference to this object so that method calls can be chained together. */ public AssociateAddressRequest withPrivateIpAddress(String privateIpAddress) { setPrivateIpAddress(privateIpAddress); return this; } /** * This method is intended for internal use only. Returns the marshaled request configured with additional * parameters to enable operation dry-run. */ @Override public Request getDryRunRequest() { Request request = new AssociateAddressRequestMarshaller().marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAllocationId() != null) sb.append("AllocationId: ").append(getAllocationId()).append(","); if (getInstanceId() != null) sb.append("InstanceId: ").append(getInstanceId()).append(","); if (getPublicIp() != null) sb.append("PublicIp: ").append(getPublicIp()).append(","); if (getAllowReassociation() != null) sb.append("AllowReassociation: ").append(getAllowReassociation()).append(","); if (getNetworkInterfaceId() != null) sb.append("NetworkInterfaceId: ").append(getNetworkInterfaceId()).append(","); if (getPrivateIpAddress() != null) sb.append("PrivateIpAddress: ").append(getPrivateIpAddress()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AssociateAddressRequest == false) return false; AssociateAddressRequest other = (AssociateAddressRequest) obj; if (other.getAllocationId() == null ^ this.getAllocationId() == null) return false; if (other.getAllocationId() != null && other.getAllocationId().equals(this.getAllocationId()) == false) return false; if (other.getInstanceId() == null ^ this.getInstanceId() == null) return false; if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == false) return false; if (other.getPublicIp() == null ^ this.getPublicIp() == null) return false; if (other.getPublicIp() != null && other.getPublicIp().equals(this.getPublicIp()) == false) return false; if (other.getAllowReassociation() == null ^ this.getAllowReassociation() == null) return false; if (other.getAllowReassociation() != null && other.getAllowReassociation().equals(this.getAllowReassociation()) == false) return false; if (other.getNetworkInterfaceId() == null ^ this.getNetworkInterfaceId() == null) return false; if (other.getNetworkInterfaceId() != null && other.getNetworkInterfaceId().equals(this.getNetworkInterfaceId()) == false) return false; if (other.getPrivateIpAddress() == null ^ this.getPrivateIpAddress() == null) return false; if (other.getPrivateIpAddress() != null && other.getPrivateIpAddress().equals(this.getPrivateIpAddress()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAllocationId() == null) ? 0 : getAllocationId().hashCode()); hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode()); hashCode = prime * hashCode + ((getPublicIp() == null) ? 0 : getPublicIp().hashCode()); hashCode = prime * hashCode + ((getAllowReassociation() == null) ? 0 : getAllowReassociation().hashCode()); hashCode = prime * hashCode + ((getNetworkInterfaceId() == null) ? 0 : getNetworkInterfaceId().hashCode()); hashCode = prime * hashCode + ((getPrivateIpAddress() == null) ? 0 : getPrivateIpAddress().hashCode()); return hashCode; } @Override public AssociateAddressRequest clone() { return (AssociateAddressRequest) super.clone(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy