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;
 

An Amazon EC2 instance that is running the Amazon ECS agent and has been registered with a cluster.

 
 public class ContainerInstance implements SerializableCloneable {

    
The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_UUID.
 
     private String containerInstanceArn;

    
The Amazon EC2 instance ID of the container instance.
 
     private String ec2InstanceId;

    
The remaining resources of the container instance that are available for new tasks.
 
The registered resources on the container instance that are in use by current tasks.
 
The status of the container instance. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that the container instance can accept tasks.
 
     private String status;

    
This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false, and instances without a connected agent cannot accept placement request.
 
     private Boolean agentConnected;

    
The number of tasks on the container instance that are in the RUNNING status.
 
     private Integer runningTasksCount;

    
The number of tasks on the container instance that are in the PENDING status.
 
     private Integer pendingTasksCount;

    
The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_UUID.

Returns:
The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_UUID.
 
     public String getContainerInstanceArn() {
         return ;
     }
    
    
The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_UUID.

Parameters:
containerInstanceArn The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_UUID.
    public void setContainerInstanceArn(String containerInstanceArn) {
        this. = containerInstanceArn;
    }
    
    
The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_UUID.

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

Parameters:
containerInstanceArn The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs namespace, followed by the region of the container instance, the AWS account ID of the container instance owner, the container-instance namespace, and then the container instance UUID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_UUID.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ContainerInstance withContainerInstanceArn(String containerInstanceArn) {
        this. = containerInstanceArn;
        return this;
    }

    
The Amazon EC2 instance ID of the container instance.

Returns:
The Amazon EC2 instance ID of the container instance.
    public String getEc2InstanceId() {
        return ;
    }
    
    
The Amazon EC2 instance ID of the container instance.

Parameters:
ec2InstanceId The Amazon EC2 instance ID of the container instance.
    public void setEc2InstanceId(String ec2InstanceId) {
        this. = ec2InstanceId;
    }
    
    
The Amazon EC2 instance ID of the container instance.

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

Parameters:
ec2InstanceId The Amazon EC2 instance ID of the container instance.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ContainerInstance withEc2InstanceId(String ec2InstanceId) {
        this. = ec2InstanceId;
        return this;
    }

    
The remaining resources of the container instance that are available for new tasks.

Returns:
The remaining resources of the container instance that are available for new tasks.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The remaining resources of the container instance that are available for new tasks.

Parameters:
remainingResources The remaining resources of the container instance that are available for new tasks.
    public void setRemainingResources(java.util.Collection<ResourceremainingResources) {
        if (remainingResources == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<ResourceremainingResourcesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<Resource>(remainingResources.size());
        remainingResourcesCopy.addAll(remainingResources);
        this. = remainingResourcesCopy;
    }
    
    
The remaining resources of the container instance that are available for new tasks.

NOTE: This method appends the values to the existing list (if any). Use setRemainingResources(java.util.Collection) or withRemainingResources(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:
remainingResources The remaining resources of the container instance that are available for new tasks.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ContainerInstance withRemainingResources(Resource... remainingResources) {
        if (getRemainingResources() == nullsetRemainingResources(new java.util.ArrayList<Resource>(remainingResources.length));
        for (Resource value : remainingResources) {
            getRemainingResources().add(value);
        }
        return this;
    }
    
    
The remaining resources of the container instance that are available for new tasks.

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

Parameters:
remainingResources The remaining resources of the container instance that are available for new tasks.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ContainerInstance withRemainingResources(java.util.Collection<ResourceremainingResources) {
        if (remainingResources == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<ResourceremainingResourcesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<Resource>(remainingResources.size());
            remainingResourcesCopy.addAll(remainingResources);
            this. = remainingResourcesCopy;
        }
        return this;
    }

    
The registered resources on the container instance that are in use by current tasks.

Returns:
The registered resources on the container instance that are in use by current tasks.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The registered resources on the container instance that are in use by current tasks.

Parameters:
registeredResources The registered resources on the container instance that are in use by current tasks.
    public void setRegisteredResources(java.util.Collection<ResourceregisteredResources) {
        if (registeredResources == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<ResourceregisteredResourcesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<Resource>(registeredResources.size());
        registeredResourcesCopy.addAll(registeredResources);
        this. = registeredResourcesCopy;
    }
    
    
The registered resources on the container instance that are in use by current tasks.

NOTE: This method appends the values to the existing list (if any). Use setRegisteredResources(java.util.Collection) or withRegisteredResources(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:
registeredResources The registered resources on the container instance that are in use by current tasks.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ContainerInstance withRegisteredResources(Resource... registeredResources) {
        if (getRegisteredResources() == nullsetRegisteredResources(new java.util.ArrayList<Resource>(registeredResources.length));
        for (Resource value : registeredResources) {
            getRegisteredResources().add(value);
        }
        return this;
    }
    
    
The registered resources on the container instance that are in use by current tasks.

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

Parameters:
registeredResources The registered resources on the container instance that are in use by current tasks.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ContainerInstance withRegisteredResources(java.util.Collection<ResourceregisteredResources) {
        if (registeredResources == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<ResourceregisteredResourcesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<Resource>(registeredResources.size());
            registeredResourcesCopy.addAll(registeredResources);
            this. = registeredResourcesCopy;
        }
        return this;
    }

    
The status of the container instance. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that the container instance can accept tasks.

Returns:
The status of the container instance. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that the container instance can accept tasks.
    public String getStatus() {
        return ;
    }
    
    
The status of the container instance. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that the container instance can accept tasks.

Parameters:
status The status of the container instance. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that the container instance can accept tasks.
    public void setStatus(String status) {
        this. = status;
    }
    
    
The status of the container instance. The valid values are ACTIVE or INACTIVE. ACTIVE indicates that the container instance can accept tasks.

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

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

    
This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false, and instances without a connected agent cannot accept placement request.

Returns:
This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false, and instances without a connected agent cannot accept placement request.
    public Boolean isAgentConnected() {
        return ;
    }
    
    
This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false, and instances without a connected agent cannot accept placement request.

Parameters:
agentConnected This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false, and instances without a connected agent cannot accept placement request.
    public void setAgentConnected(Boolean agentConnected) {
        this. = agentConnected;
    }
    
    
This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false, and instances without a connected agent cannot accept placement request.

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

Parameters:
agentConnected This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false, and instances without a connected agent cannot accept placement request.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ContainerInstance withAgentConnected(Boolean agentConnected) {
        this. = agentConnected;
        return this;
    }

    
This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false, and instances without a connected agent cannot accept placement request.

Returns:
This parameter returns true if the agent is actually connected to Amazon ECS. Registered instances with an agent that may be unhealthy or stopped will return false, and instances without a connected agent cannot accept placement request.
    public Boolean getAgentConnected() {
        return ;
    }

    
The number of tasks on the container instance that are in the RUNNING status.

Returns:
The number of tasks on the container instance that are in the RUNNING status.
    public Integer getRunningTasksCount() {
        return ;
    }
    
    
The number of tasks on the container instance that are in the RUNNING status.

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

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

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

    
The number of tasks on the container instance that are in the PENDING status.

Returns:
The number of tasks on the container instance that are in the PENDING status.
    public Integer getPendingTasksCount() {
        return ;
    }
    
    
The number of tasks on the container instance that are in the PENDING status.

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

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

Parameters:
pendingTasksCount The number of tasks on the container instance that are in the PENDING status.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ContainerInstance 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 (getContainerInstanceArn() != nullsb.append("ContainerInstanceArn: " + getContainerInstanceArn() + ",");
        if (getEc2InstanceId() != nullsb.append("Ec2InstanceId: " + getEc2InstanceId() + ",");
        if (getRemainingResources() != nullsb.append("RemainingResources: " + getRemainingResources() + ",");
        if (getRegisteredResources() != nullsb.append("RegisteredResources: " + getRegisteredResources() + ",");
        if (getStatus() != nullsb.append("Status: " + getStatus() + ",");
        if (isAgentConnected() != nullsb.append("AgentConnected: " + isAgentConnected() + ",");
        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 + ((getContainerInstanceArn() == null) ? 0 : getContainerInstanceArn().hashCode()); 
        hashCode = prime * hashCode + ((getEc2InstanceId() == null) ? 0 : getEc2InstanceId().hashCode()); 
        hashCode = prime * hashCode + ((getRemainingResources() == null) ? 0 : getRemainingResources().hashCode()); 
        hashCode = prime * hashCode + ((getRegisteredResources() == null) ? 0 : getRegisteredResources().hashCode()); 
        hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); 
        hashCode = prime * hashCode + ((isAgentConnected() == null) ? 0 : isAgentConnected().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 ContainerInstance == falsereturn false;
        ContainerInstance other = (ContainerInstance)obj;
        
        if (other.getContainerInstanceArn() == null ^ this.getContainerInstanceArn() == nullreturn false;
        if (other.getContainerInstanceArn() != null && other.getContainerInstanceArn().equals(this.getContainerInstanceArn()) == falsereturn false
        if (other.getEc2InstanceId() == null ^ this.getEc2InstanceId() == nullreturn false;
        if (other.getEc2InstanceId() != null && other.getEc2InstanceId().equals(this.getEc2InstanceId()) == falsereturn false
        if (other.getRemainingResources() == null ^ this.getRemainingResources() == nullreturn false;
        if (other.getRemainingResources() != null && other.getRemainingResources().equals(this.getRemainingResources()) == falsereturn false
        if (other.getRegisteredResources() == null ^ this.getRegisteredResources() == nullreturn false;
        if (other.getRegisteredResources() != null && other.getRegisteredResources().equals(this.getRegisteredResources()) == falsereturn false
        if (other.getStatus() == null ^ this.getStatus() == nullreturn false;
        if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == falsereturn false
        if (other.isAgentConnected() == null ^ this.isAgentConnected() == nullreturn false;
        if (other.isAgentConnected() != null && other.isAgentConnected().equals(this.isAgentConnected()) == 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 ContainerInstance clone() {
        try {
            return (ContainerInstancesuper.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