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;
 

This entity represents an instance group, which is a group of instances that have common purpose. For example, CORE instance group is used for HDFS.

 
 public class InstanceGroup implements SerializableCloneable {

    
The identifier of the instance group.
 
     private String id;

    
The name of the instance group.
 
     private String name;

    
The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.

Constraints:
Allowed Values: ON_DEMAND, SPOT

 
     private String market;

    
The type of the instance group. Valid values are MASTER, CORE or TASK.

Constraints:
Allowed Values: MASTER, CORE, TASK

 
     private String instanceGroupType;

    
The bid price for each EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.
 
     private String bidPrice;

    
The EC2 instance type for all instances in the instance group.

Constraints:
Length: 1 - 256
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

 
     private String instanceType;

    
The target number of instances for the instance group.
 
     private Integer requestedInstanceCount;

    
The number of instances currently running in this instance group.
 
     private Integer runningInstanceCount;

    
The current status of the instance group.
 
     private InstanceGroupStatus status;

    
The identifier of the instance group.

Returns:
The identifier of the instance group.
 
     public String getId() {
         return ;
     }
    
    
The identifier of the instance group.

Parameters:
id The identifier of the instance group.
 
     public void setId(String id) {
        this. = id;
    }
    
    
The identifier of the instance group.

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

Parameters:
id The identifier of the instance group.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InstanceGroup withId(String id) {
        this. = id;
        return this;
    }

    
The name of the instance group.

Returns:
The name of the instance group.
    public String getName() {
        return ;
    }
    
    
The name of the instance group.

Parameters:
name The name of the instance group.
    public void setName(String name) {
        this. = name;
    }
    
    
The name of the instance group.

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

Parameters:
name The name of the instance group.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InstanceGroup withName(String name) {
        this. = name;
        return this;
    }

    
The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.

Constraints:
Allowed Values: ON_DEMAND, SPOT

Returns:
The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.
See also:
MarketType
    public String getMarket() {
        return ;
    }
    
    
The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.

Constraints:
Allowed Values: ON_DEMAND, SPOT

Parameters:
market The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.
See also:
MarketType
    public void setMarket(String market) {
        this. = market;
    }
    
    
The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.

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

Constraints:
Allowed Values: ON_DEMAND, SPOT

Parameters:
market The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
MarketType
    public InstanceGroup withMarket(String market) {
        this. = market;
        return this;
    }

    
The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.

Constraints:
Allowed Values: ON_DEMAND, SPOT

Parameters:
market The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.
See also:
MarketType
    public void setMarket(MarketType market) {
        this. = market.toString();
    }
    
    
The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.

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

Constraints:
Allowed Values: ON_DEMAND, SPOT

Parameters:
market The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
MarketType
    public InstanceGroup withMarket(MarketType market) {
        this. = market.toString();
        return this;
    }

    
The type of the instance group. Valid values are MASTER, CORE or TASK.

Constraints:
Allowed Values: MASTER, CORE, TASK

Returns:
The type of the instance group. Valid values are MASTER, CORE or TASK.
See also:
InstanceGroupType
    public String getInstanceGroupType() {
        return ;
    }
    
    
The type of the instance group. Valid values are MASTER, CORE or TASK.

Constraints:
Allowed Values: MASTER, CORE, TASK

Parameters:
instanceGroupType The type of the instance group. Valid values are MASTER, CORE or TASK.
See also:
InstanceGroupType
    public void setInstanceGroupType(String instanceGroupType) {
        this. = instanceGroupType;
    }
    
    
The type of the instance group. Valid values are MASTER, CORE or TASK.

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

Constraints:
Allowed Values: MASTER, CORE, TASK

Parameters:
instanceGroupType The type of the instance group. Valid values are MASTER, CORE or TASK.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
InstanceGroupType
    public InstanceGroup withInstanceGroupType(String instanceGroupType) {
        this. = instanceGroupType;
        return this;
    }

    
The type of the instance group. Valid values are MASTER, CORE or TASK.

Constraints:
Allowed Values: MASTER, CORE, TASK

Parameters:
instanceGroupType The type of the instance group. Valid values are MASTER, CORE or TASK.
See also:
InstanceGroupType
    public void setInstanceGroupType(InstanceGroupType instanceGroupType) {
        this. = instanceGroupType.toString();
    }
    
    
The type of the instance group. Valid values are MASTER, CORE or TASK.

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

Constraints:
Allowed Values: MASTER, CORE, TASK

Parameters:
instanceGroupType The type of the instance group. Valid values are MASTER, CORE or TASK.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
InstanceGroupType
    public InstanceGroup withInstanceGroupType(InstanceGroupType instanceGroupType) {
        this. = instanceGroupType.toString();
        return this;
    }

    
The bid price for each EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.

Returns:
The bid price for each EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.
    public String getBidPrice() {
        return ;
    }
    
    
The bid price for each EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.

Parameters:
bidPrice The bid price for each EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.
    public void setBidPrice(String bidPrice) {
        this. = bidPrice;
    }
    
    
The bid price for each EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.

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

Parameters:
bidPrice The bid price for each EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InstanceGroup withBidPrice(String bidPrice) {
        this. = bidPrice;
        return this;
    }

    
The EC2 instance type for all instances in the instance group.

Constraints:
Length: 1 - 256
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Returns:
The EC2 instance type for all instances in the instance group.
    public String getInstanceType() {
        return ;
    }
    
    
The EC2 instance type for all instances in the instance group.

Constraints:
Length: 1 - 256
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Parameters:
instanceType The EC2 instance type for all instances in the instance group.
    public void setInstanceType(String instanceType) {
        this. = instanceType;
    }
    
    
The EC2 instance type for all instances in the instance group.

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

Constraints:
Length: 1 - 256
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Parameters:
instanceType The EC2 instance type for all instances in the instance group.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InstanceGroup withInstanceType(String instanceType) {
        this. = instanceType;
        return this;
    }

    
The target number of instances for the instance group.

Returns:
The target number of instances for the instance group.
        return ;
    }
    
    
The target number of instances for the instance group.

Parameters:
requestedInstanceCount The target number of instances for the instance group.
    public void setRequestedInstanceCount(Integer requestedInstanceCount) {
        this. = requestedInstanceCount;
    }
    
    
The target number of instances for the instance group.

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

Parameters:
requestedInstanceCount The target number of instances for the instance group.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InstanceGroup withRequestedInstanceCount(Integer requestedInstanceCount) {
        this. = requestedInstanceCount;
        return this;
    }

    
The number of instances currently running in this instance group.

Returns:
The number of instances currently running in this instance group.
    public Integer getRunningInstanceCount() {
        return ;
    }
    
    
The number of instances currently running in this instance group.

Parameters:
runningInstanceCount The number of instances currently running in this instance group.
    public void setRunningInstanceCount(Integer runningInstanceCount) {
        this. = runningInstanceCount;
    }
    
    
The number of instances currently running in this instance group.

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

Parameters:
runningInstanceCount The number of instances currently running in this instance group.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InstanceGroup withRunningInstanceCount(Integer runningInstanceCount) {
        this. = runningInstanceCount;
        return this;
    }

    
The current status of the instance group.

Returns:
The current status of the instance group.
    public InstanceGroupStatus getStatus() {
        return ;
    }
    
    
The current status of the instance group.

Parameters:
status The current status of the instance group.
    public void setStatus(InstanceGroupStatus status) {
        this. = status;
    }
    
    
The current status of the instance group.

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

Parameters:
status The current status of the instance group.
Returns:
A reference to this updated object so that method calls can be chained together.
    public InstanceGroup withStatus(InstanceGroupStatus status) {
        this. = status;
        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 (getId() != nullsb.append("Id: " + getId() + ",");
        if (getName() != nullsb.append("Name: " + getName() + ",");
        if (getMarket() != nullsb.append("Market: " + getMarket() + ",");
        if (getInstanceGroupType() != nullsb.append("InstanceGroupType: " + getInstanceGroupType() + ",");
        if (getBidPrice() != nullsb.append("BidPrice: " + getBidPrice() + ",");
        if (getInstanceType() != nullsb.append("InstanceType: " + getInstanceType() + ",");
        if (getRequestedInstanceCount() != nullsb.append("RequestedInstanceCount: " + getRequestedInstanceCount() + ",");
        if (getRunningInstanceCount() != nullsb.append("RunningInstanceCount: " + getRunningInstanceCount() + ",");
        if (getStatus() != nullsb.append("Status: " + getStatus() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); 
        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); 
        hashCode = prime * hashCode + ((getMarket() == null) ? 0 : getMarket().hashCode()); 
        hashCode = prime * hashCode + ((getInstanceGroupType() == null) ? 0 : getInstanceGroupType().hashCode()); 
        hashCode = prime * hashCode + ((getBidPrice() == null) ? 0 : getBidPrice().hashCode()); 
        hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode()); 
        hashCode = prime * hashCode + ((getRequestedInstanceCount() == null) ? 0 : getRequestedInstanceCount().hashCode()); 
        hashCode = prime * hashCode + ((getRunningInstanceCount() == null) ? 0 : getRunningInstanceCount().hashCode()); 
        hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof InstanceGroup == falsereturn false;
        InstanceGroup other = (InstanceGroup)obj;
        
        if (other.getId() == null ^ this.getId() == nullreturn false;
        if (other.getId() != null && other.getId().equals(this.getId()) == falsereturn false
        if (other.getName() == null ^ this.getName() == nullreturn false;
        if (other.getName() != null && other.getName().equals(this.getName()) == falsereturn false
        if (other.getMarket() == null ^ this.getMarket() == nullreturn false;
        if (other.getMarket() != null && other.getMarket().equals(this.getMarket()) == falsereturn false
        if (other.getInstanceGroupType() == null ^ this.getInstanceGroupType() == nullreturn false;
        if (other.getInstanceGroupType() != null && other.getInstanceGroupType().equals(this.getInstanceGroupType()) == falsereturn false
        if (other.getBidPrice() == null ^ this.getBidPrice() == nullreturn false;
        if (other.getBidPrice() != null && other.getBidPrice().equals(this.getBidPrice()) == falsereturn false
        if (other.getInstanceType() == null ^ this.getInstanceType() == nullreturn false;
        if (other.getInstanceType() != null && other.getInstanceType().equals(this.getInstanceType()) == falsereturn false
        if (other.getRequestedInstanceCount() == null ^ this.getRequestedInstanceCount() == nullreturn false;
        if (other.getRequestedInstanceCount() != null && other.getRequestedInstanceCount().equals(this.getRequestedInstanceCount()) == falsereturn false
        if (other.getRunningInstanceCount() == null ^ this.getRunningInstanceCount() == nullreturn false;
        if (other.getRunningInstanceCount() != null && other.getRunningInstanceCount().equals(this.getRunningInstanceCount()) == falsereturn false
        if (other.getStatus() == null ^ this.getStatus() == nullreturn false;
        if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == falsereturn false
        return true;
    }
    
    @Override
    public InstanceGroup clone() {
        try {
            return (InstanceGroupsuper.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