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.elasticmapreduce.model;
 

Provides information about the EC2 instances in a cluster grouped by category. For example, key name, subnet ID, IAM instance profile, and so on.

 
 public class Ec2InstanceAttributes implements SerializableCloneable {

    
The name of the Amazon EC2 key pair to use when connecting with SSH into the master node as a user named "hadoop".
 
     private String ec2KeyName;

    
To launch the job flow in Amazon VPC, set this parameter to the identifier of the Amazon VPC subnet where you want the job flow to launch. If you do not specify this value, the job flow is launched in the normal AWS cloud, outside of a VPC.

Amazon VPC currently does not support cluster compute quadruple extra large (cc1.4xlarge) instances. Thus, you cannot specify the cc1.4xlarge instance type for nodes of a job flow launched in a VPC.

 
     private String ec2SubnetId;

    
The Availability Zone in which the cluster will run.
 
     private String ec2AvailabilityZone;

    
The IAM role that was specified when the job flow was launched. The EC2 instances of the job flow assume this role.
 
     private String iamInstanceProfile;

    
The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the master node.
 
     private String emrManagedMasterSecurityGroup;

    
The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the slave nodes.
 
     private String emrManagedSlaveSecurityGroup;

    
A list of additional Amazon EC2 security group IDs for the master node.
 
A list of additional Amazon EC2 security group IDs for the slave nodes.
 
The name of the Amazon EC2 key pair to use when connecting with SSH into the master node as a user named "hadoop".

Returns:
The name of the Amazon EC2 key pair to use when connecting with SSH into the master node as a user named "hadoop".
 
     public String getEc2KeyName() {
         return ;
     }
    
    
The name of the Amazon EC2 key pair to use when connecting with SSH into the master node as a user named "hadoop".

Parameters:
ec2KeyName The name of the Amazon EC2 key pair to use when connecting with SSH into the master node as a user named "hadoop".
 
     public void setEc2KeyName(String ec2KeyName) {
         this. = ec2KeyName;
    }
    
    
The name of the Amazon EC2 key pair to use when connecting with SSH into the master node as a user named "hadoop".

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

Parameters:
ec2KeyName The name of the Amazon EC2 key pair to use when connecting with SSH into the master node as a user named "hadoop".
Returns:
A reference to this updated object so that method calls can be chained together.
    public Ec2InstanceAttributes withEc2KeyName(String ec2KeyName) {
        this. = ec2KeyName;
        return this;
    }

    
To launch the job flow in Amazon VPC, set this parameter to the identifier of the Amazon VPC subnet where you want the job flow to launch. If you do not specify this value, the job flow is launched in the normal AWS cloud, outside of a VPC.

Amazon VPC currently does not support cluster compute quadruple extra large (cc1.4xlarge) instances. Thus, you cannot specify the cc1.4xlarge instance type for nodes of a job flow launched in a VPC.

Returns:
To launch the job flow in Amazon VPC, set this parameter to the identifier of the Amazon VPC subnet where you want the job flow to launch. If you do not specify this value, the job flow is launched in the normal AWS cloud, outside of a VPC.

Amazon VPC currently does not support cluster compute quadruple extra large (cc1.4xlarge) instances. Thus, you cannot specify the cc1.4xlarge instance type for nodes of a job flow launched in a VPC.

    public String getEc2SubnetId() {
        return ;
    }
    
    
To launch the job flow in Amazon VPC, set this parameter to the identifier of the Amazon VPC subnet where you want the job flow to launch. If you do not specify this value, the job flow is launched in the normal AWS cloud, outside of a VPC.

Amazon VPC currently does not support cluster compute quadruple extra large (cc1.4xlarge) instances. Thus, you cannot specify the cc1.4xlarge instance type for nodes of a job flow launched in a VPC.

Parameters:
ec2SubnetId To launch the job flow in Amazon VPC, set this parameter to the identifier of the Amazon VPC subnet where you want the job flow to launch. If you do not specify this value, the job flow is launched in the normal AWS cloud, outside of a VPC.

Amazon VPC currently does not support cluster compute quadruple extra large (cc1.4xlarge) instances. Thus, you cannot specify the cc1.4xlarge instance type for nodes of a job flow launched in a VPC.

    public void setEc2SubnetId(String ec2SubnetId) {
        this. = ec2SubnetId;
    }
    
    
To launch the job flow in Amazon VPC, set this parameter to the identifier of the Amazon VPC subnet where you want the job flow to launch. If you do not specify this value, the job flow is launched in the normal AWS cloud, outside of a VPC.

Amazon VPC currently does not support cluster compute quadruple extra large (cc1.4xlarge) instances. Thus, you cannot specify the cc1.4xlarge instance type for nodes of a job flow launched in a VPC.

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

Parameters:
ec2SubnetId To launch the job flow in Amazon VPC, set this parameter to the identifier of the Amazon VPC subnet where you want the job flow to launch. If you do not specify this value, the job flow is launched in the normal AWS cloud, outside of a VPC.

Amazon VPC currently does not support cluster compute quadruple extra large (cc1.4xlarge) instances. Thus, you cannot specify the cc1.4xlarge instance type for nodes of a job flow launched in a VPC.

Returns:
A reference to this updated object so that method calls can be chained together.
    public Ec2InstanceAttributes withEc2SubnetId(String ec2SubnetId) {
        this. = ec2SubnetId;
        return this;
    }

    
The Availability Zone in which the cluster will run.

Returns:
The Availability Zone in which the cluster will run.
    public String getEc2AvailabilityZone() {
        return ;
    }
    
    
The Availability Zone in which the cluster will run.

Parameters:
ec2AvailabilityZone The Availability Zone in which the cluster will run.
    public void setEc2AvailabilityZone(String ec2AvailabilityZone) {
        this. = ec2AvailabilityZone;
    }
    
    
The Availability Zone in which the cluster will run.

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

Parameters:
ec2AvailabilityZone The Availability Zone in which the cluster will run.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Ec2InstanceAttributes withEc2AvailabilityZone(String ec2AvailabilityZone) {
        this. = ec2AvailabilityZone;
        return this;
    }

    
The IAM role that was specified when the job flow was launched. The EC2 instances of the job flow assume this role.

Returns:
The IAM role that was specified when the job flow was launched. The EC2 instances of the job flow assume this role.
    public String getIamInstanceProfile() {
        return ;
    }
    
    
The IAM role that was specified when the job flow was launched. The EC2 instances of the job flow assume this role.

Parameters:
iamInstanceProfile The IAM role that was specified when the job flow was launched. The EC2 instances of the job flow assume this role.
    public void setIamInstanceProfile(String iamInstanceProfile) {
        this. = iamInstanceProfile;
    }
    
    
The IAM role that was specified when the job flow was launched. The EC2 instances of the job flow assume this role.

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

Parameters:
iamInstanceProfile The IAM role that was specified when the job flow was launched. The EC2 instances of the job flow assume this role.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Ec2InstanceAttributes withIamInstanceProfile(String iamInstanceProfile) {
        this. = iamInstanceProfile;
        return this;
    }

    
The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the master node.

Returns:
The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the master node.
        return ;
    }
    
    
The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the master node.

Parameters:
emrManagedMasterSecurityGroup The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the master node.
    public void setEmrManagedMasterSecurityGroup(String emrManagedMasterSecurityGroup) {
        this. = emrManagedMasterSecurityGroup;
    }
    
    
The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the master node.

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

Parameters:
emrManagedMasterSecurityGroup The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the master node.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Ec2InstanceAttributes withEmrManagedMasterSecurityGroup(String emrManagedMasterSecurityGroup) {
        this. = emrManagedMasterSecurityGroup;
        return this;
    }

    
The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the slave nodes.

Returns:
The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the slave nodes.
        return ;
    }
    
    
The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the slave nodes.

Parameters:
emrManagedSlaveSecurityGroup The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the slave nodes.
    public void setEmrManagedSlaveSecurityGroup(String emrManagedSlaveSecurityGroup) {
        this. = emrManagedSlaveSecurityGroup;
    }
    
    
The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the slave nodes.

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

Parameters:
emrManagedSlaveSecurityGroup The identifier of the Amazon EC2 security group (managed by Amazon Elastic MapReduce) for the slave nodes.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Ec2InstanceAttributes withEmrManagedSlaveSecurityGroup(String emrManagedSlaveSecurityGroup) {
        this. = emrManagedSlaveSecurityGroup;
        return this;
    }

    
A list of additional Amazon EC2 security group IDs for the master node.

Returns:
A list of additional Amazon EC2 security group IDs for the master node.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A list of additional Amazon EC2 security group IDs for the master node.

Parameters:
additionalMasterSecurityGroups A list of additional Amazon EC2 security group IDs for the master node.
    public void setAdditionalMasterSecurityGroups(java.util.Collection<StringadditionalMasterSecurityGroups) {
        if (additionalMasterSecurityGroups == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<StringadditionalMasterSecurityGroupsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(additionalMasterSecurityGroups.size());
        additionalMasterSecurityGroupsCopy.addAll(additionalMasterSecurityGroups);
        this. = additionalMasterSecurityGroupsCopy;
    }
    
    
A list of additional Amazon EC2 security group IDs for the master node.

NOTE: This method appends the values to the existing list (if any). Use setAdditionalMasterSecurityGroups(java.util.Collection) or withAdditionalMasterSecurityGroups(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:
additionalMasterSecurityGroups A list of additional Amazon EC2 security group IDs for the master node.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Ec2InstanceAttributes withAdditionalMasterSecurityGroups(String... additionalMasterSecurityGroups) {
        if (getAdditionalMasterSecurityGroups() == nullsetAdditionalMasterSecurityGroups(new java.util.ArrayList<String>(additionalMasterSecurityGroups.length));
        for (String value : additionalMasterSecurityGroups) {
            getAdditionalMasterSecurityGroups().add(value);
        }
        return this;
    }
    
    
A list of additional Amazon EC2 security group IDs for the master node.

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

Parameters:
additionalMasterSecurityGroups A list of additional Amazon EC2 security group IDs for the master node.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Ec2InstanceAttributes withAdditionalMasterSecurityGroups(java.util.Collection<StringadditionalMasterSecurityGroups) {
        if (additionalMasterSecurityGroups == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringadditionalMasterSecurityGroupsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(additionalMasterSecurityGroups.size());
            additionalMasterSecurityGroupsCopy.addAll(additionalMasterSecurityGroups);
            this. = additionalMasterSecurityGroupsCopy;
        }
        return this;
    }

    
A list of additional Amazon EC2 security group IDs for the slave nodes.

Returns:
A list of additional Amazon EC2 security group IDs for the slave nodes.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A list of additional Amazon EC2 security group IDs for the slave nodes.

Parameters:
additionalSlaveSecurityGroups A list of additional Amazon EC2 security group IDs for the slave nodes.
    public void setAdditionalSlaveSecurityGroups(java.util.Collection<StringadditionalSlaveSecurityGroups) {
        if (additionalSlaveSecurityGroups == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<StringadditionalSlaveSecurityGroupsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(additionalSlaveSecurityGroups.size());
        additionalSlaveSecurityGroupsCopy.addAll(additionalSlaveSecurityGroups);
        this. = additionalSlaveSecurityGroupsCopy;
    }
    
    
A list of additional Amazon EC2 security group IDs for the slave nodes.

NOTE: This method appends the values to the existing list (if any). Use setAdditionalSlaveSecurityGroups(java.util.Collection) or withAdditionalSlaveSecurityGroups(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:
additionalSlaveSecurityGroups A list of additional Amazon EC2 security group IDs for the slave nodes.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Ec2InstanceAttributes withAdditionalSlaveSecurityGroups(String... additionalSlaveSecurityGroups) {
        if (getAdditionalSlaveSecurityGroups() == nullsetAdditionalSlaveSecurityGroups(new java.util.ArrayList<String>(additionalSlaveSecurityGroups.length));
        for (String value : additionalSlaveSecurityGroups) {
            getAdditionalSlaveSecurityGroups().add(value);
        }
        return this;
    }
    
    
A list of additional Amazon EC2 security group IDs for the slave nodes.

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

Parameters:
additionalSlaveSecurityGroups A list of additional Amazon EC2 security group IDs for the slave nodes.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Ec2InstanceAttributes withAdditionalSlaveSecurityGroups(java.util.Collection<StringadditionalSlaveSecurityGroups) {
        if (additionalSlaveSecurityGroups == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringadditionalSlaveSecurityGroupsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(additionalSlaveSecurityGroups.size());
            additionalSlaveSecurityGroupsCopy.addAll(additionalSlaveSecurityGroups);
            this. = additionalSlaveSecurityGroupsCopy;
        }
        return this;
    }

    
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 (getEc2KeyName() != nullsb.append("Ec2KeyName: " + getEc2KeyName() + ",");
        if (getEc2SubnetId() != nullsb.append("Ec2SubnetId: " + getEc2SubnetId() + ",");
        if (getEc2AvailabilityZone() != nullsb.append("Ec2AvailabilityZone: " + getEc2AvailabilityZone() + ",");
        if (getIamInstanceProfile() != nullsb.append("IamInstanceProfile: " + getIamInstanceProfile() + ",");
        if (getEmrManagedMasterSecurityGroup() != nullsb.append("EmrManagedMasterSecurityGroup: " + getEmrManagedMasterSecurityGroup() + ",");
        if (getEmrManagedSlaveSecurityGroup() != nullsb.append("EmrManagedSlaveSecurityGroup: " + getEmrManagedSlaveSecurityGroup() + ",");
        if (getAdditionalMasterSecurityGroups() != nullsb.append("AdditionalMasterSecurityGroups: " + getAdditionalMasterSecurityGroups() + ",");
        if (getAdditionalSlaveSecurityGroups() != nullsb.append("AdditionalSlaveSecurityGroups: " + getAdditionalSlaveSecurityGroups() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getEc2KeyName() == null) ? 0 : getEc2KeyName().hashCode()); 
        hashCode = prime * hashCode + ((getEc2SubnetId() == null) ? 0 : getEc2SubnetId().hashCode()); 
        hashCode = prime * hashCode + ((getEc2AvailabilityZone() == null) ? 0 : getEc2AvailabilityZone().hashCode()); 
        hashCode = prime * hashCode + ((getIamInstanceProfile() == null) ? 0 : getIamInstanceProfile().hashCode()); 
        hashCode = prime * hashCode + ((getEmrManagedMasterSecurityGroup() == null) ? 0 : getEmrManagedMasterSecurityGroup().hashCode()); 
        hashCode = prime * hashCode + ((getEmrManagedSlaveSecurityGroup() == null) ? 0 : getEmrManagedSlaveSecurityGroup().hashCode()); 
        hashCode = prime * hashCode + ((getAdditionalMasterSecurityGroups() == null) ? 0 : getAdditionalMasterSecurityGroups().hashCode()); 
        hashCode = prime * hashCode + ((getAdditionalSlaveSecurityGroups() == null) ? 0 : getAdditionalSlaveSecurityGroups().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Ec2InstanceAttributes == falsereturn false;
        Ec2InstanceAttributes other = (Ec2InstanceAttributes)obj;
        
        if (other.getEc2KeyName() == null ^ this.getEc2KeyName() == nullreturn false;
        if (other.getEc2KeyName() != null && other.getEc2KeyName().equals(this.getEc2KeyName()) == falsereturn false
        if (other.getEc2SubnetId() == null ^ this.getEc2SubnetId() == nullreturn false;
        if (other.getEc2SubnetId() != null && other.getEc2SubnetId().equals(this.getEc2SubnetId()) == falsereturn false
        if (other.getEc2AvailabilityZone() == null ^ this.getEc2AvailabilityZone() == nullreturn false;
        if (other.getEc2AvailabilityZone() != null && other.getEc2AvailabilityZone().equals(this.getEc2AvailabilityZone()) == falsereturn false
        if (other.getIamInstanceProfile() == null ^ this.getIamInstanceProfile() == nullreturn false;
        if (other.getIamInstanceProfile() != null && other.getIamInstanceProfile().equals(this.getIamInstanceProfile()) == falsereturn false
        if (other.getEmrManagedMasterSecurityGroup() == null ^ this.getEmrManagedMasterSecurityGroup() == nullreturn false;
        if (other.getEmrManagedMasterSecurityGroup() != null && other.getEmrManagedMasterSecurityGroup().equals(this.getEmrManagedMasterSecurityGroup()) == falsereturn false
        if (other.getEmrManagedSlaveSecurityGroup() == null ^ this.getEmrManagedSlaveSecurityGroup() == nullreturn false;
        if (other.getEmrManagedSlaveSecurityGroup() != null && other.getEmrManagedSlaveSecurityGroup().equals(this.getEmrManagedSlaveSecurityGroup()) == falsereturn false
        if (other.getAdditionalMasterSecurityGroups() == null ^ this.getAdditionalMasterSecurityGroups() == nullreturn false;
        if (other.getAdditionalMasterSecurityGroups() != null && other.getAdditionalMasterSecurityGroups().equals(this.getAdditionalMasterSecurityGroups()) == falsereturn false
        if (other.getAdditionalSlaveSecurityGroups() == null ^ this.getAdditionalSlaveSecurityGroups() == nullreturn false;
        if (other.getAdditionalSlaveSecurityGroups() != null && other.getAdditionalSlaveSecurityGroups().equals(this.getAdditionalSlaveSecurityGroups()) == falsereturn false
        return true;
    }
    
    @Override
    public Ec2InstanceAttributes clone() {
        try {
            return (Ec2InstanceAttributessuper.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