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

A regional grouping of one or more container instances on which you can run task requests. Each account receives a default cluster the first time you use the Amazon ECS service, but you may also create other clusters. Clusters may contain more than one instance type simultaneously.

IMPORTANT: During the preview, each account is limited to two clusters.

 
 public class Cluster implements SerializableCloneable {

    
The Amazon Resource Name (ARN) that identifies the cluster. The ARN contains the arn:aws:ecs namespace, followed by the region of the cluster, the AWS account ID of the cluster owner, the cluster namespace, and then the cluster name. For example, arn:aws:ecs:region:012345678910:cluster/test.
 
     private String clusterArn;

    
A user-generated string that you can use to identify your cluster.
 
     private String clusterName;

    
The status of the cluster. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that you can register container instances with the cluster and the associated instances can accept tasks.
 
     private String status;

    
The number of container instances registered into the cluster.
 
     private Integer registeredContainerInstancesCount;

    
The number of tasks in the cluster that are in the RUNNING state.
 
     private Integer runningTasksCount;

    
The number of tasks in the cluster that are in the PENDING state.
 
     private Integer pendingTasksCount;

    
The Amazon Resource Name (ARN) that identifies the cluster. The ARN contains the arn:aws:ecs namespace, followed by the region of the cluster, the AWS account ID of the cluster owner, the cluster namespace, and then the cluster name. For example, arn:aws:ecs:region:012345678910:cluster/test.

Returns:
The Amazon Resource Name (ARN) that identifies the cluster. The ARN contains the arn:aws:ecs namespace, followed by the region of the cluster, the AWS account ID of the cluster owner, the cluster namespace, and then the cluster name. For example, arn:aws:ecs:region:012345678910:cluster/test.
 
     public String getClusterArn() {
         return ;
     }
    
    
The Amazon Resource Name (ARN) that identifies the cluster. The ARN contains the arn:aws:ecs namespace, followed by the region of the cluster, the AWS account ID of the cluster owner, the cluster namespace, and then the cluster name. For example, arn:aws:ecs:region:012345678910:cluster/test.

Parameters:
clusterArn The Amazon Resource Name (ARN) that identifies the cluster. The ARN contains the arn:aws:ecs namespace, followed by the region of the cluster, the AWS account ID of the cluster owner, the cluster namespace, and then the cluster name. For example, arn:aws:ecs:region:012345678910:cluster/test.
    public void setClusterArn(String clusterArn) {
        this. = clusterArn;
    }
    
    
The Amazon Resource Name (ARN) that identifies the cluster. The ARN contains the arn:aws:ecs namespace, followed by the region of the cluster, the AWS account ID of the cluster owner, the cluster namespace, and then the cluster name. For example, arn:aws:ecs:region:012345678910:cluster/test.

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

Parameters:
clusterArn The Amazon Resource Name (ARN) that identifies the cluster. The ARN contains the arn:aws:ecs namespace, followed by the region of the cluster, the AWS account ID of the cluster owner, the cluster namespace, and then the cluster name. For example, arn:aws:ecs:region:012345678910:cluster/test.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Cluster withClusterArn(String clusterArn) {
        this. = clusterArn;
        return this;
    }

    
A user-generated string that you can use to identify your cluster.

Returns:
A user-generated string that you can use to identify your cluster.
    public String getClusterName() {
        return ;
    }
    
    
A user-generated string that you can use to identify your cluster.

Parameters:
clusterName A user-generated string that you can use to identify your cluster.
    public void setClusterName(String clusterName) {
        this. = clusterName;
    }
    
    
A user-generated string that you can use to identify your cluster.

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

Parameters:
clusterName A user-generated string that you can use to identify your cluster.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Cluster withClusterName(String clusterName) {
        this. = clusterName;
        return this;
    }

    
The status of the cluster. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that you can register container instances with the cluster and the associated instances can accept tasks.

Returns:
The status of the cluster. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that you can register container instances with the cluster and the associated instances can accept tasks.
    public String getStatus() {
        return ;
    }
    
    
The status of the cluster. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that you can register container instances with the cluster and the associated instances can accept tasks.

Parameters:
status The status of the cluster. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that you can register container instances with the cluster and the associated instances can accept tasks.
    public void setStatus(String status) {
        this. = status;
    }
    
    
The status of the cluster. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that you can register container instances with the cluster and the associated instances can accept tasks.

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

Parameters:
status The status of the cluster. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that you can register container instances with the cluster and the associated instances can accept tasks.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Cluster withStatus(String status) {
        this. = status;
        return this;
    }

    
The number of container instances registered into the cluster.

Returns:
The number of container instances registered into the cluster.
        return ;
    }
    
    
The number of container instances registered into the cluster.

Parameters:
registeredContainerInstancesCount The number of container instances registered into the cluster.
    public void setRegisteredContainerInstancesCount(Integer registeredContainerInstancesCount) {
        this. = registeredContainerInstancesCount;
    }
    
    
The number of container instances registered into the cluster.

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

Parameters:
registeredContainerInstancesCount The number of container instances registered into the cluster.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Cluster withRegisteredContainerInstancesCount(Integer registeredContainerInstancesCount) {
        this. = registeredContainerInstancesCount;
        return this;
    }

    
The number of tasks in the cluster that are in the RUNNING state.

Returns:
The number of tasks in the cluster that are in the RUNNING state.
    public Integer getRunningTasksCount() {
        return ;
    }
    
    
The number of tasks in the cluster that are in the RUNNING state.

Parameters:
runningTasksCount The number of tasks in the cluster that are in the RUNNING state.
    public void setRunningTasksCount(Integer runningTasksCount) {
        this. = runningTasksCount;
    }
    
    
The number of tasks in the cluster that are in the RUNNING state.

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

Parameters:
runningTasksCount The number of tasks in the cluster that are in the RUNNING state.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Cluster withRunningTasksCount(Integer runningTasksCount) {
        this. = runningTasksCount;
        return this;
    }

    
The number of tasks in the cluster that are in the PENDING state.

Returns:
The number of tasks in the cluster that are in the PENDING state.
    public Integer getPendingTasksCount() {
        return ;
    }
    
    
The number of tasks in the cluster that are in the PENDING state.

Parameters:
pendingTasksCount The number of tasks in the cluster that are in the PENDING state.
    public void setPendingTasksCount(Integer pendingTasksCount) {
        this. = pendingTasksCount;
    }
    
    
The number of tasks in the cluster that are in the PENDING state.

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

Parameters:
pendingTasksCount The number of tasks in the cluster that are in the PENDING state.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Cluster withPendingTasksCount(Integer pendingTasksCount) {
        this. = pendingTasksCount;
        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 (getClusterArn() != nullsb.append("ClusterArn: " + getClusterArn() + ",");
        if (getClusterName() != nullsb.append("ClusterName: " + getClusterName() + ",");
        if (getStatus() != nullsb.append("Status: " + getStatus() + ",");
        if (getRegisteredContainerInstancesCount() != nullsb.append("RegisteredContainerInstancesCount: " + getRegisteredContainerInstancesCount() + ",");
        if (getRunningTasksCount() != nullsb.append("RunningTasksCount: " + getRunningTasksCount() + ",");
        if (getPendingTasksCount() != nullsb.append("PendingTasksCount: " + getPendingTasksCount() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getClusterArn() == null) ? 0 : getClusterArn().hashCode()); 
        hashCode = prime * hashCode + ((getClusterName() == null) ? 0 : getClusterName().hashCode()); 
        hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); 
        hashCode = prime * hashCode + ((getRegisteredContainerInstancesCount() == null) ? 0 : getRegisteredContainerInstancesCount().hashCode()); 
        hashCode = prime * hashCode + ((getRunningTasksCount() == null) ? 0 : getRunningTasksCount().hashCode()); 
        hashCode = prime * hashCode + ((getPendingTasksCount() == null) ? 0 : getPendingTasksCount().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Cluster == falsereturn false;
        Cluster other = (Cluster)obj;
        
        if (other.getClusterArn() == null ^ this.getClusterArn() == nullreturn false;
        if (other.getClusterArn() != null && other.getClusterArn().equals(this.getClusterArn()) == falsereturn false
        if (other.getClusterName() == null ^ this.getClusterName() == nullreturn false;
        if (other.getClusterName() != null && other.getClusterName().equals(this.getClusterName()) == falsereturn false
        if (other.getStatus() == null ^ this.getStatus() == nullreturn false;
        if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == falsereturn false
        if (other.getRegisteredContainerInstancesCount() == null ^ this.getRegisteredContainerInstancesCount() == nullreturn false;
        if (other.getRegisteredContainerInstancesCount() != null && other.getRegisteredContainerInstancesCount().equals(this.getRegisteredContainerInstancesCount()) == falsereturn false
        if (other.getRunningTasksCount() == null ^ this.getRunningTasksCount() == nullreturn false;
        if (other.getRunningTasksCount() != null && other.getRunningTasksCount().equals(this.getRunningTasksCount()) == falsereturn false
        if (other.getPendingTasksCount() == null ^ this.getPendingTasksCount() == nullreturn false;
        if (other.getPendingTasksCount() != null && other.getPendingTasksCount().equals(this.getPendingTasksCount()) == falsereturn false
        return true;
    }
    
    @Override
    public Cluster clone() {
        try {
            return (Clustersuper.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