All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.ecs.model.ContainerInstance Maven / Gradle / Ivy

Go to download

The AWS Java SDK for the Amazon EC2 Container Service holds the client classes that are used for communicating with the Amazon EC2 Container Service

There is a newer version: 1.12.780
Show newest version
/*
 * Copyright 2010-2016 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;

import java.io.Serializable;

/**
 * 

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

*/ public class ContainerInstance implements Serializable, Cloneable { /** *

* 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 ID. For example, * arn:aws:ecs:region:aws_account_id * :container-instance/container_instance_ID. *

*/ private String containerInstanceArn; /** *

* The EC2 instance ID of the container instance. *

*/ private String ec2InstanceId; /** *

* The version information for the Amazon ECS container agent and Docker * daemon running on the container instance. *

*/ private VersionInfo versionInfo; /** *

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

*/ private com.amazonaws.internal.SdkInternalList remainingResources; /** *

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

*/ private com.amazonaws.internal.SdkInternalList registeredResources; /** *

* 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 return false, and instances without a * connected agent cannot accept placement requests. *

*/ 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 status of the most recent agent update. If an update has never been * requested, this value is NULL. *

*/ private String agentUpdateStatus; /** *

* The attributes set for the container instance by the Amazon ECS container * agent at instance registration. *

*/ private com.amazonaws.internal.SdkInternalList attributes; /** *

* 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 ID. For example, * arn:aws:ecs:region:aws_account_id * :container-instance/container_instance_ID. *

* * @param 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 ID. For example, * arn:aws * :ecs:region:aws_account_id:container-instance/ * container_instance_ID. */ public void setContainerInstanceArn(String containerInstanceArn) { this.containerInstanceArn = 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 ID. For example, * arn:aws:ecs:region:aws_account_id * :container-instance/container_instance_ID. *

* * @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 ID. For example, * arn:aws * :ecs:region:aws_account_id:container-instance * /container_instance_ID. */ public String getContainerInstanceArn() { return 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 ID. For example, * arn:aws:ecs:region:aws_account_id * :container-instance/container_instance_ID. *

* * @param 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 ID. For example, * arn:aws * :ecs:region:aws_account_id:container-instance/ * container_instance_ID. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withContainerInstanceArn( String containerInstanceArn) { setContainerInstanceArn(containerInstanceArn); return this; } /** *

* The EC2 instance ID of the container instance. *

* * @param ec2InstanceId * The EC2 instance ID of the container instance. */ public void setEc2InstanceId(String ec2InstanceId) { this.ec2InstanceId = ec2InstanceId; } /** *

* The EC2 instance ID of the container instance. *

* * @return The EC2 instance ID of the container instance. */ public String getEc2InstanceId() { return this.ec2InstanceId; } /** *

* The EC2 instance ID of the container instance. *

* * @param ec2InstanceId * The EC2 instance ID of the container instance. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withEc2InstanceId(String ec2InstanceId) { setEc2InstanceId(ec2InstanceId); return this; } /** *

* The version information for the Amazon ECS container agent and Docker * daemon running on the container instance. *

* * @param versionInfo * The version information for the Amazon ECS container agent and * Docker daemon running on the container instance. */ public void setVersionInfo(VersionInfo versionInfo) { this.versionInfo = versionInfo; } /** *

* The version information for the Amazon ECS container agent and Docker * daemon running on the container instance. *

* * @return The version information for the Amazon ECS container agent and * Docker daemon running on the container instance. */ public VersionInfo getVersionInfo() { return this.versionInfo; } /** *

* The version information for the Amazon ECS container agent and Docker * daemon running on the container instance. *

* * @param versionInfo * The version information for the Amazon ECS container agent and * Docker daemon running on the container instance. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withVersionInfo(VersionInfo versionInfo) { setVersionInfo(versionInfo); return this; } /** *

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

* * @return The remaining resources of the container instance that are * available for new tasks. */ public java.util.List getRemainingResources() { if (remainingResources == null) { remainingResources = new com.amazonaws.internal.SdkInternalList(); } return remainingResources; } /** *

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

* * @param remainingResources * The remaining resources of the container instance that are * available for new tasks. */ public void setRemainingResources( java.util.Collection remainingResources) { if (remainingResources == null) { this.remainingResources = null; return; } this.remainingResources = new com.amazonaws.internal.SdkInternalList( remainingResources); } /** *

* 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 {@link #setRemainingResources(java.util.Collection)} or * {@link #withRemainingResources(java.util.Collection)} if you want to * override the existing values. *

* * @param remainingResources * The remaining resources of the container instance that are * available for new tasks. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withRemainingResources( Resource... remainingResources) { if (this.remainingResources == null) { setRemainingResources(new com.amazonaws.internal.SdkInternalList( remainingResources.length)); } for (Resource ele : remainingResources) { this.remainingResources.add(ele); } return this; } /** *

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

* * @param remainingResources * The remaining resources of the container instance that are * available for new tasks. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withRemainingResources( java.util.Collection remainingResources) { setRemainingResources(remainingResources); return this; } /** *

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

* * @return The registered resources on the container instance that are in * use by current tasks. */ public java.util.List getRegisteredResources() { if (registeredResources == null) { registeredResources = new com.amazonaws.internal.SdkInternalList(); } return registeredResources; } /** *

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

* * @param registeredResources * The registered resources on the container instance that are in use * by current tasks. */ public void setRegisteredResources( java.util.Collection registeredResources) { if (registeredResources == null) { this.registeredResources = null; return; } this.registeredResources = new com.amazonaws.internal.SdkInternalList( registeredResources); } /** *

* 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 {@link #setRegisteredResources(java.util.Collection)} or * {@link #withRegisteredResources(java.util.Collection)} if you want to * override the existing values. *

* * @param registeredResources * The registered resources on the container instance that are in use * by current tasks. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withRegisteredResources( Resource... registeredResources) { if (this.registeredResources == null) { setRegisteredResources(new com.amazonaws.internal.SdkInternalList( registeredResources.length)); } for (Resource ele : registeredResources) { this.registeredResources.add(ele); } return this; } /** *

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

* * @param registeredResources * The registered resources on the container instance that are in use * by current tasks. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withRegisteredResources( java.util.Collection registeredResources) { setRegisteredResources(registeredResources); return this; } /** *

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

* * @param 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 = status; } /** *

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

* * @return 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 this.status; } /** *

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

* * @param status * The status of the container instance. The valid values are * ACTIVE or INACTIVE. ACTIVE * indicates that the container instance can accept tasks. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withStatus(String status) { setStatus(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 return false, and instances without a * connected agent cannot accept placement requests. *

* * @param 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 return false, and * instances without a connected agent cannot accept placement * requests. */ public void setAgentConnected(Boolean agentConnected) { this.agentConnected = 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 return false, and instances without a * connected agent cannot accept placement requests. *

* * @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 return false, and * instances without a connected agent cannot accept placement * requests. */ public Boolean getAgentConnected() { return 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 return false, and instances without a * connected agent cannot accept placement requests. *

* * @param 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 return false, and * instances without a connected agent cannot accept placement * requests. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withAgentConnected(Boolean agentConnected) { setAgentConnected(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 return false, and instances without a * connected agent cannot accept placement requests. *

* * @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 return false, and * instances without a connected agent cannot accept placement * requests. */ public Boolean isAgentConnected() { return this.agentConnected; } /** *

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

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

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

* * @return The number of tasks on the container instance that are in the * RUNNING status. */ public Integer getRunningTasksCount() { return this.runningTasksCount; } /** *

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

* * @param runningTasksCount * The number of tasks on the container instance that are in the * RUNNING status. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withRunningTasksCount(Integer runningTasksCount) { setRunningTasksCount(runningTasksCount); return this; } /** *

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

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

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

* * @return The number of tasks on the container instance that are in the * PENDING status. */ public Integer getPendingTasksCount() { return this.pendingTasksCount; } /** *

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

* * @param pendingTasksCount * The number of tasks on the container instance that are in the * PENDING status. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withPendingTasksCount(Integer pendingTasksCount) { setPendingTasksCount(pendingTasksCount); return this; } /** *

* The status of the most recent agent update. If an update has never been * requested, this value is NULL. *

* * @param agentUpdateStatus * The status of the most recent agent update. If an update has never * been requested, this value is NULL. * @see AgentUpdateStatus */ public void setAgentUpdateStatus(String agentUpdateStatus) { this.agentUpdateStatus = agentUpdateStatus; } /** *

* The status of the most recent agent update. If an update has never been * requested, this value is NULL. *

* * @return The status of the most recent agent update. If an update has * never been requested, this value is NULL. * @see AgentUpdateStatus */ public String getAgentUpdateStatus() { return this.agentUpdateStatus; } /** *

* The status of the most recent agent update. If an update has never been * requested, this value is NULL. *

* * @param agentUpdateStatus * The status of the most recent agent update. If an update has never * been requested, this value is NULL. * @return Returns a reference to this object so that method calls can be * chained together. * @see AgentUpdateStatus */ public ContainerInstance withAgentUpdateStatus(String agentUpdateStatus) { setAgentUpdateStatus(agentUpdateStatus); return this; } /** *

* The status of the most recent agent update. If an update has never been * requested, this value is NULL. *

* * @param agentUpdateStatus * The status of the most recent agent update. If an update has never * been requested, this value is NULL. * @return Returns a reference to this object so that method calls can be * chained together. * @see AgentUpdateStatus */ public void setAgentUpdateStatus(AgentUpdateStatus agentUpdateStatus) { this.agentUpdateStatus = agentUpdateStatus.toString(); } /** *

* The status of the most recent agent update. If an update has never been * requested, this value is NULL. *

* * @param agentUpdateStatus * The status of the most recent agent update. If an update has never * been requested, this value is NULL. * @return Returns a reference to this object so that method calls can be * chained together. * @see AgentUpdateStatus */ public ContainerInstance withAgentUpdateStatus( AgentUpdateStatus agentUpdateStatus) { setAgentUpdateStatus(agentUpdateStatus); return this; } /** *

* The attributes set for the container instance by the Amazon ECS container * agent at instance registration. *

* * @return The attributes set for the container instance by the Amazon ECS * container agent at instance registration. */ public java.util.List getAttributes() { if (attributes == null) { attributes = new com.amazonaws.internal.SdkInternalList(); } return attributes; } /** *

* The attributes set for the container instance by the Amazon ECS container * agent at instance registration. *

* * @param attributes * The attributes set for the container instance by the Amazon ECS * container agent at instance registration. */ public void setAttributes(java.util.Collection attributes) { if (attributes == null) { this.attributes = null; return; } this.attributes = new com.amazonaws.internal.SdkInternalList( attributes); } /** *

* The attributes set for the container instance by the Amazon ECS container * agent at instance registration. *

*

* NOTE: This method appends the values to the existing list (if * any). Use {@link #setAttributes(java.util.Collection)} or * {@link #withAttributes(java.util.Collection)} if you want to override the * existing values. *

* * @param attributes * The attributes set for the container instance by the Amazon ECS * container agent at instance registration. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withAttributes(Attribute... attributes) { if (this.attributes == null) { setAttributes(new com.amazonaws.internal.SdkInternalList( attributes.length)); } for (Attribute ele : attributes) { this.attributes.add(ele); } return this; } /** *

* The attributes set for the container instance by the Amazon ECS container * agent at instance registration. *

* * @param attributes * The attributes set for the container instance by the Amazon ECS * container agent at instance registration. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContainerInstance withAttributes( java.util.Collection attributes) { setAttributes(attributes); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getContainerInstanceArn() != null) sb.append("ContainerInstanceArn: " + getContainerInstanceArn() + ","); if (getEc2InstanceId() != null) sb.append("Ec2InstanceId: " + getEc2InstanceId() + ","); if (getVersionInfo() != null) sb.append("VersionInfo: " + getVersionInfo() + ","); if (getRemainingResources() != null) sb.append("RemainingResources: " + getRemainingResources() + ","); if (getRegisteredResources() != null) sb.append("RegisteredResources: " + getRegisteredResources() + ","); if (getStatus() != null) sb.append("Status: " + getStatus() + ","); if (getAgentConnected() != null) sb.append("AgentConnected: " + getAgentConnected() + ","); if (getRunningTasksCount() != null) sb.append("RunningTasksCount: " + getRunningTasksCount() + ","); if (getPendingTasksCount() != null) sb.append("PendingTasksCount: " + getPendingTasksCount() + ","); if (getAgentUpdateStatus() != null) sb.append("AgentUpdateStatus: " + getAgentUpdateStatus() + ","); if (getAttributes() != null) sb.append("Attributes: " + getAttributes()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ContainerInstance == false) return false; ContainerInstance other = (ContainerInstance) obj; if (other.getContainerInstanceArn() == null ^ this.getContainerInstanceArn() == null) return false; if (other.getContainerInstanceArn() != null && other.getContainerInstanceArn().equals( this.getContainerInstanceArn()) == false) return false; if (other.getEc2InstanceId() == null ^ this.getEc2InstanceId() == null) return false; if (other.getEc2InstanceId() != null && other.getEc2InstanceId().equals(this.getEc2InstanceId()) == false) return false; if (other.getVersionInfo() == null ^ this.getVersionInfo() == null) return false; if (other.getVersionInfo() != null && other.getVersionInfo().equals(this.getVersionInfo()) == false) return false; if (other.getRemainingResources() == null ^ this.getRemainingResources() == null) return false; if (other.getRemainingResources() != null && other.getRemainingResources().equals( this.getRemainingResources()) == false) return false; if (other.getRegisteredResources() == null ^ this.getRegisteredResources() == null) return false; if (other.getRegisteredResources() != null && other.getRegisteredResources().equals( this.getRegisteredResources()) == false) return false; if (other.getStatus() == null ^ this.getStatus() == null) return false; if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) return false; if (other.getAgentConnected() == null ^ this.getAgentConnected() == null) return false; if (other.getAgentConnected() != null && other.getAgentConnected().equals(this.getAgentConnected()) == false) return false; if (other.getRunningTasksCount() == null ^ this.getRunningTasksCount() == null) return false; if (other.getRunningTasksCount() != null && other.getRunningTasksCount().equals( this.getRunningTasksCount()) == false) return false; if (other.getPendingTasksCount() == null ^ this.getPendingTasksCount() == null) return false; if (other.getPendingTasksCount() != null && other.getPendingTasksCount().equals( this.getPendingTasksCount()) == false) return false; if (other.getAgentUpdateStatus() == null ^ this.getAgentUpdateStatus() == null) return false; if (other.getAgentUpdateStatus() != null && other.getAgentUpdateStatus().equals( this.getAgentUpdateStatus()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; return true; } @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 + ((getVersionInfo() == null) ? 0 : getVersionInfo().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 + ((getAgentConnected() == null) ? 0 : getAgentConnected() .hashCode()); hashCode = prime * hashCode + ((getRunningTasksCount() == null) ? 0 : getRunningTasksCount().hashCode()); hashCode = prime * hashCode + ((getPendingTasksCount() == null) ? 0 : getPendingTasksCount().hashCode()); hashCode = prime * hashCode + ((getAgentUpdateStatus() == null) ? 0 : getAgentUpdateStatus().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); return hashCode; } @Override public ContainerInstance clone() { try { return (ContainerInstance) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException( "Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy