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;
 

Describes a network interface.

 
 public class InstanceNetworkInterfaceSpecification implements SerializableCloneable {

    
The ID of the network interface.
 
     private String networkInterfaceId;

    
The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.
 
     private Integer deviceIndex;

    
The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.
 
     private String subnetId;

    
The description of the network interface. Applies only if creating a network interface when launching an instance.
 
     private String description;

    
The private IP address of the network interface. Applies only if creating a network interface when launching an instance.
 
     private String privateIpAddress;

    
The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.
 
If set to true, the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.
 
     private Boolean deleteOnTermination;

    
One or more private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.
 
The number of secondary private IP addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option.
 
     private Integer secondaryPrivateIpAddressCount;

    
Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.
 
     private Boolean associatePublicIpAddress;

    
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.
        this. = networkInterfaceId;
        return this;
    }

    
The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.

Returns:
The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.
    public Integer getDeviceIndex() {
        return ;
    }
    
    
The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.

Parameters:
deviceIndex The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.
    public void setDeviceIndex(Integer deviceIndex) {
        this. = deviceIndex;
    }
    
    
The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.

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

Parameters:
deviceIndex The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = deviceIndex;
        return this;
    }

    
The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.

Returns:
The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.
    public String getSubnetId() {
        return ;
    }
    
    
The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.

Parameters:
subnetId The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.
    public void setSubnetId(String subnetId) {
        this. = subnetId;
    }
    
    
The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.

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

Parameters:
subnetId The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = subnetId;
        return this;
    }

    
The description of the network interface. Applies only if creating a network interface when launching an instance.

Returns:
The description of the network interface. Applies only if creating a network interface when launching an instance.
    public String getDescription() {
        return ;
    }
    
    
The description of the network interface. Applies only if creating a network interface when launching an instance.

Parameters:
description The description of the network interface. Applies only if creating a network interface when launching an instance.
    public void setDescription(String description) {
        this. = description;
    }
    
    
The description of the network interface. Applies only if creating a network interface when launching an instance.

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

Parameters:
description The description of the network interface. Applies only if creating a network interface when launching an instance.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = description;
        return this;
    }

    
The private IP address of the network interface. Applies only if creating a network interface when launching an instance.

Returns:
The private IP address of the network interface. Applies only if creating a network interface when launching an instance.
    public String getPrivateIpAddress() {
        return ;
    }
    
    
The private IP address of the network interface. Applies only if creating a network interface when launching an instance.

Parameters:
privateIpAddress The private IP address of the network interface. Applies only if creating a network interface when launching an instance.
    public void setPrivateIpAddress(String privateIpAddress) {
        this. = privateIpAddress;
    }
    
    
The private IP address of the network interface. Applies only if creating a network interface when launching an instance.

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

Parameters:
privateIpAddress The private IP address of the network interface. Applies only if creating a network interface when launching an instance.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = privateIpAddress;
        return this;
    }

    
The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.

Returns:
The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.
    public java.util.List<StringgetGroups() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.

Parameters:
groups The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.
    public void setGroups(java.util.Collection<Stringgroups) {
        if (groups == null) {
            this. = null;
            return;
        }
        groupsCopy.addAll(groups);
        this. = groupsCopy;
    }
    
    
The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.

NOTE: This method appends the values to the existing list (if any). Use setGroups(java.util.Collection) or withGroups(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:
groups The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (getGroups() == nullsetGroups(new java.util.ArrayList<String>(groups.length));
        for (String value : groups) {
            getGroups().add(value);
        }
        return this;
    }
    
    
The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.

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

Parameters:
groups The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (groups == null) {
            this. = null;
        } else {
            groupsCopy.addAll(groups);
            this. = groupsCopy;
        }
        return this;
    }

    
If set to true, the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.

Returns:
If set to true, the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.
    public Boolean isDeleteOnTermination() {
        return ;
    }
    
    
If set to true, the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.

Parameters:
deleteOnTermination If set to true, the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.
    public void setDeleteOnTermination(Boolean deleteOnTermination) {
        this. = deleteOnTermination;
    }
    
    
If set to true, the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.

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

Parameters:
deleteOnTermination If set to true, the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = deleteOnTermination;
        return this;
    }

    
If set to true, the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.

Returns:
If set to true, the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.
    public Boolean getDeleteOnTermination() {
        return ;
    }

    
One or more private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.

Returns:
One or more private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
One or more private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.

Parameters:
privateIpAddresses One or more private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.
    public void setPrivateIpAddresses(java.util.Collection<PrivateIpAddressSpecificationprivateIpAddresses) {
        if (privateIpAddresses == null) {
            this. = null;
            return;
        }
        privateIpAddressesCopy.addAll(privateIpAddresses);
        this. = privateIpAddressesCopy;
    }
    
    
One or more private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.

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 private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (getPrivateIpAddresses() == nullsetPrivateIpAddresses(new java.util.ArrayList<PrivateIpAddressSpecification>(privateIpAddresses.length));
        for (PrivateIpAddressSpecification value : privateIpAddresses) {
            getPrivateIpAddresses().add(value);
        }
        return this;
    }
    
    
One or more private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.

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

Parameters:
privateIpAddresses One or more private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (privateIpAddresses == null) {
            this. = null;
        } else {
            privateIpAddressesCopy.addAll(privateIpAddresses);
            this. = privateIpAddressesCopy;
        }
        return this;
    }

    
The number of secondary private IP addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option.

Returns:
The number of secondary private IP addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option.
        return ;
    }
    
    
The number of secondary private IP addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option.

Parameters:
secondaryPrivateIpAddressCount The number of secondary private IP addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option.
    public void setSecondaryPrivateIpAddressCount(Integer secondaryPrivateIpAddressCount) {
        this. = secondaryPrivateIpAddressCount;
    }
    
    
The number of secondary private IP addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option.

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

Parameters:
secondaryPrivateIpAddressCount The number of secondary private IP addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InstanceNetworkInterfaceSpecification withSecondaryPrivateIpAddressCount(Integer secondaryPrivateIpAddressCount) {
        this. = secondaryPrivateIpAddressCount;
        return this;
    }

    
Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.

Returns:
Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.
        return ;
    }
    
    
Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.

Parameters:
associatePublicIpAddress Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.
    public void setAssociatePublicIpAddress(Boolean associatePublicIpAddress) {
        this. = associatePublicIpAddress;
    }
    
    
Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.

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

Parameters:
associatePublicIpAddress Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = associatePublicIpAddress;
        return this;
    }

    
Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.

Returns:
Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.
        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 (getDeviceIndex() != nullsb.append("DeviceIndex: " + getDeviceIndex() + ",");
        if (getSubnetId() != nullsb.append("SubnetId: " + getSubnetId() + ",");
        if (getDescription() != nullsb.append("Description: " + getDescription() + ",");
        if (getPrivateIpAddress() != nullsb.append("PrivateIpAddress: " + getPrivateIpAddress() + ",");
        if (getGroups() != nullsb.append("Groups: " + getGroups() + ",");
        if (isDeleteOnTermination() != nullsb.append("DeleteOnTermination: " + isDeleteOnTermination() + ",");
        if (getPrivateIpAddresses() != nullsb.append("PrivateIpAddresses: " + getPrivateIpAddresses() + ",");
        if (getSecondaryPrivateIpAddressCount() != nullsb.append("SecondaryPrivateIpAddressCount: " + getSecondaryPrivateIpAddressCount() + ",");
        if (isAssociatePublicIpAddress() != nullsb.append("AssociatePublicIpAddress: " + isAssociatePublicIpAddress() );
        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 + ((getDeviceIndex() == null) ? 0 : getDeviceIndex().hashCode()); 
        hashCode = prime * hashCode + ((getSubnetId() == null) ? 0 : getSubnetId().hashCode()); 
        hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); 
        hashCode = prime * hashCode + ((getPrivateIpAddress() == null) ? 0 : getPrivateIpAddress().hashCode()); 
        hashCode = prime * hashCode + ((getGroups() == null) ? 0 : getGroups().hashCode()); 
        hashCode = prime * hashCode + ((isDeleteOnTermination() == null) ? 0 : isDeleteOnTermination().hashCode()); 
        hashCode = prime * hashCode + ((getPrivateIpAddresses() == null) ? 0 : getPrivateIpAddresses().hashCode()); 
        hashCode = prime * hashCode + ((getSecondaryPrivateIpAddressCount() == null) ? 0 : getSecondaryPrivateIpAddressCount().hashCode()); 
        hashCode = prime * hashCode + ((isAssociatePublicIpAddress() == null) ? 0 : isAssociatePublicIpAddress().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof InstanceNetworkInterfaceSpecification == falsereturn false;
        
        if (other.getNetworkInterfaceId() == null ^ this.getNetworkInterfaceId() == nullreturn false;
        if (other.getNetworkInterfaceId() != null && other.getNetworkInterfaceId().equals(this.getNetworkInterfaceId()) == falsereturn false
        if (other.getDeviceIndex() == null ^ this.getDeviceIndex() == nullreturn false;
        if (other.getDeviceIndex() != null && other.getDeviceIndex().equals(this.getDeviceIndex()) == falsereturn false
        if (other.getSubnetId() == null ^ this.getSubnetId() == nullreturn false;
        if (other.getSubnetId() != null && other.getSubnetId().equals(this.getSubnetId()) == falsereturn false
        if (other.getDescription() == null ^ this.getDescription() == nullreturn false;
        if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == falsereturn false
        if (other.getPrivateIpAddress() == null ^ this.getPrivateIpAddress() == nullreturn false;
        if (other.getPrivateIpAddress() != null && other.getPrivateIpAddress().equals(this.getPrivateIpAddress()) == falsereturn false
        if (other.getGroups() == null ^ this.getGroups() == nullreturn false;
        if (other.getGroups() != null && other.getGroups().equals(this.getGroups()) == falsereturn false
        if (other.isDeleteOnTermination() == null ^ this.isDeleteOnTermination() == nullreturn false;
        if (other.isDeleteOnTermination() != null && other.isDeleteOnTermination().equals(this.isDeleteOnTermination()) == 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.isAssociatePublicIpAddress() == null ^ this.isAssociatePublicIpAddress() == nullreturn false;
        if (other.isAssociatePublicIpAddress() != null && other.isAssociatePublicIpAddress().equals(this.isAssociatePublicIpAddress()) == falsereturn false
        return true;
    }
    
    @Override
        try {
            return (InstanceNetworkInterfaceSpecificationsuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X