com.amazonaws.services.ecs.model.TaskDefinition Maven / Gradle / Ivy
/*
* 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;
/**
*
* Details of a task definition.
*
*/
public class TaskDefinition implements Serializable, Cloneable {
/**
*
* The full Amazon Resource Name (ARN) of the of the task definition.
*
*/
private String taskDefinitionArn;
/**
*
* A list of container definitions in JSON format that describe the
* different containers that make up your task. For more information about
* container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service
* Developer Guide.
*
*/
private com.amazonaws.internal.SdkInternalList containerDefinitions;
/**
*
* The family of your task definition, used as the definition name.
*
*/
private String family;
/**
*
* The revision of the task in a particular family. The revision is a
* version number of a task definition in a family. When you register a task
* definition for the first time, the revision is 1
; each time
* you register a new revision of a task definition in the same family, the
* revision value always increases by one (even if you have deregistered
* previous revisions in this family).
*
*/
private Integer revision;
/**
*
* The list of volumes in a task. For more information about volume
* definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service
* Developer Guide.
*
*/
private com.amazonaws.internal.SdkInternalList volumes;
/**
*
* The status of the task definition.
*
*/
private String status;
/**
*
* The container instance attributes required by your task.
*
*/
private com.amazonaws.internal.SdkInternalList requiresAttributes;
/**
*
* The full Amazon Resource Name (ARN) of the of the task definition.
*
*
* @param taskDefinitionArn
* The full Amazon Resource Name (ARN) of the of the task definition.
*/
public void setTaskDefinitionArn(String taskDefinitionArn) {
this.taskDefinitionArn = taskDefinitionArn;
}
/**
*
* The full Amazon Resource Name (ARN) of the of the task definition.
*
*
* @return The full Amazon Resource Name (ARN) of the of the task
* definition.
*/
public String getTaskDefinitionArn() {
return this.taskDefinitionArn;
}
/**
*
* The full Amazon Resource Name (ARN) of the of the task definition.
*
*
* @param taskDefinitionArn
* The full Amazon Resource Name (ARN) of the of the task definition.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public TaskDefinition withTaskDefinitionArn(String taskDefinitionArn) {
setTaskDefinitionArn(taskDefinitionArn);
return this;
}
/**
*
* A list of container definitions in JSON format that describe the
* different containers that make up your task. For more information about
* container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service
* Developer Guide.
*
*
* @return A list of container definitions in JSON format that describe the
* different containers that make up your task. For more information
* about container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container
* Service Developer Guide.
*/
public java.util.List getContainerDefinitions() {
if (containerDefinitions == null) {
containerDefinitions = new com.amazonaws.internal.SdkInternalList();
}
return containerDefinitions;
}
/**
*
* A list of container definitions in JSON format that describe the
* different containers that make up your task. For more information about
* container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service
* Developer Guide.
*
*
* @param containerDefinitions
* A list of container definitions in JSON format that describe the
* different containers that make up your task. For more information
* about container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container
* Service Developer Guide.
*/
public void setContainerDefinitions(
java.util.Collection containerDefinitions) {
if (containerDefinitions == null) {
this.containerDefinitions = null;
return;
}
this.containerDefinitions = new com.amazonaws.internal.SdkInternalList(
containerDefinitions);
}
/**
*
* A list of container definitions in JSON format that describe the
* different containers that make up your task. For more information about
* container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service
* Developer Guide.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setContainerDefinitions(java.util.Collection)} or
* {@link #withContainerDefinitions(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param containerDefinitions
* A list of container definitions in JSON format that describe the
* different containers that make up your task. For more information
* about container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container
* Service Developer Guide.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public TaskDefinition withContainerDefinitions(
ContainerDefinition... containerDefinitions) {
if (this.containerDefinitions == null) {
setContainerDefinitions(new com.amazonaws.internal.SdkInternalList(
containerDefinitions.length));
}
for (ContainerDefinition ele : containerDefinitions) {
this.containerDefinitions.add(ele);
}
return this;
}
/**
*
* A list of container definitions in JSON format that describe the
* different containers that make up your task. For more information about
* container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service
* Developer Guide.
*
*
* @param containerDefinitions
* A list of container definitions in JSON format that describe the
* different containers that make up your task. For more information
* about container definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container
* Service Developer Guide.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public TaskDefinition withContainerDefinitions(
java.util.Collection containerDefinitions) {
setContainerDefinitions(containerDefinitions);
return this;
}
/**
*
* The family of your task definition, used as the definition name.
*
*
* @param family
* The family of your task definition, used as the definition name.
*/
public void setFamily(String family) {
this.family = family;
}
/**
*
* The family of your task definition, used as the definition name.
*
*
* @return The family of your task definition, used as the definition name.
*/
public String getFamily() {
return this.family;
}
/**
*
* The family of your task definition, used as the definition name.
*
*
* @param family
* The family of your task definition, used as the definition name.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public TaskDefinition withFamily(String family) {
setFamily(family);
return this;
}
/**
*
* The revision of the task in a particular family. The revision is a
* version number of a task definition in a family. When you register a task
* definition for the first time, the revision is 1
; each time
* you register a new revision of a task definition in the same family, the
* revision value always increases by one (even if you have deregistered
* previous revisions in this family).
*
*
* @param revision
* The revision of the task in a particular family. The revision is a
* version number of a task definition in a family. When you register
* a task definition for the first time, the revision is
* 1
; each time you register a new revision of a task
* definition in the same family, the revision value always increases
* by one (even if you have deregistered previous revisions in this
* family).
*/
public void setRevision(Integer revision) {
this.revision = revision;
}
/**
*
* The revision of the task in a particular family. The revision is a
* version number of a task definition in a family. When you register a task
* definition for the first time, the revision is 1
; each time
* you register a new revision of a task definition in the same family, the
* revision value always increases by one (even if you have deregistered
* previous revisions in this family).
*
*
* @return The revision of the task in a particular family. The revision is
* a version number of a task definition in a family. When you
* register a task definition for the first time, the revision is
* 1
; each time you register a new revision of a task
* definition in the same family, the revision value always
* increases by one (even if you have deregistered previous
* revisions in this family).
*/
public Integer getRevision() {
return this.revision;
}
/**
*
* The revision of the task in a particular family. The revision is a
* version number of a task definition in a family. When you register a task
* definition for the first time, the revision is 1
; each time
* you register a new revision of a task definition in the same family, the
* revision value always increases by one (even if you have deregistered
* previous revisions in this family).
*
*
* @param revision
* The revision of the task in a particular family. The revision is a
* version number of a task definition in a family. When you register
* a task definition for the first time, the revision is
* 1
; each time you register a new revision of a task
* definition in the same family, the revision value always increases
* by one (even if you have deregistered previous revisions in this
* family).
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public TaskDefinition withRevision(Integer revision) {
setRevision(revision);
return this;
}
/**
*
* The list of volumes in a task. For more information about volume
* definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service
* Developer Guide.
*
*
* @return The list of volumes in a task. For more information about volume
* definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container
* Service Developer Guide.
*/
public java.util.List getVolumes() {
if (volumes == null) {
volumes = new com.amazonaws.internal.SdkInternalList();
}
return volumes;
}
/**
*
* The list of volumes in a task. For more information about volume
* definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service
* Developer Guide.
*
*
* @param volumes
* The list of volumes in a task. For more information about volume
* definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container
* Service Developer Guide.
*/
public void setVolumes(java.util.Collection volumes) {
if (volumes == null) {
this.volumes = null;
return;
}
this.volumes = new com.amazonaws.internal.SdkInternalList(
volumes);
}
/**
*
* The list of volumes in a task. For more information about volume
* definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service
* Developer Guide.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setVolumes(java.util.Collection)} or
* {@link #withVolumes(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param volumes
* The list of volumes in a task. For more information about volume
* definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container
* Service Developer Guide.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public TaskDefinition withVolumes(Volume... volumes) {
if (this.volumes == null) {
setVolumes(new com.amazonaws.internal.SdkInternalList(
volumes.length));
}
for (Volume ele : volumes) {
this.volumes.add(ele);
}
return this;
}
/**
*
* The list of volumes in a task. For more information about volume
* definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service
* Developer Guide.
*
*
* @param volumes
* The list of volumes in a task. For more information about volume
* definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container
* Service Developer Guide.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public TaskDefinition withVolumes(java.util.Collection volumes) {
setVolumes(volumes);
return this;
}
/**
*
* The status of the task definition.
*
*
* @param status
* The status of the task definition.
* @see TaskDefinitionStatus
*/
public void setStatus(String status) {
this.status = status;
}
/**
*
* The status of the task definition.
*
*
* @return The status of the task definition.
* @see TaskDefinitionStatus
*/
public String getStatus() {
return this.status;
}
/**
*
* The status of the task definition.
*
*
* @param status
* The status of the task definition.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see TaskDefinitionStatus
*/
public TaskDefinition withStatus(String status) {
setStatus(status);
return this;
}
/**
*
* The status of the task definition.
*
*
* @param status
* The status of the task definition.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see TaskDefinitionStatus
*/
public void setStatus(TaskDefinitionStatus status) {
this.status = status.toString();
}
/**
*
* The status of the task definition.
*
*
* @param status
* The status of the task definition.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see TaskDefinitionStatus
*/
public TaskDefinition withStatus(TaskDefinitionStatus status) {
setStatus(status);
return this;
}
/**
*
* The container instance attributes required by your task.
*
*
* @return The container instance attributes required by your task.
*/
public java.util.List getRequiresAttributes() {
if (requiresAttributes == null) {
requiresAttributes = new com.amazonaws.internal.SdkInternalList();
}
return requiresAttributes;
}
/**
*
* The container instance attributes required by your task.
*
*
* @param requiresAttributes
* The container instance attributes required by your task.
*/
public void setRequiresAttributes(
java.util.Collection requiresAttributes) {
if (requiresAttributes == null) {
this.requiresAttributes = null;
return;
}
this.requiresAttributes = new com.amazonaws.internal.SdkInternalList(
requiresAttributes);
}
/**
*
* The container instance attributes required by your task.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setRequiresAttributes(java.util.Collection)} or
* {@link #withRequiresAttributes(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param requiresAttributes
* The container instance attributes required by your task.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public TaskDefinition withRequiresAttributes(
Attribute... requiresAttributes) {
if (this.requiresAttributes == null) {
setRequiresAttributes(new com.amazonaws.internal.SdkInternalList(
requiresAttributes.length));
}
for (Attribute ele : requiresAttributes) {
this.requiresAttributes.add(ele);
}
return this;
}
/**
*
* The container instance attributes required by your task.
*
*
* @param requiresAttributes
* The container instance attributes required by your task.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public TaskDefinition withRequiresAttributes(
java.util.Collection requiresAttributes) {
setRequiresAttributes(requiresAttributes);
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 (getTaskDefinitionArn() != null)
sb.append("TaskDefinitionArn: " + getTaskDefinitionArn() + ",");
if (getContainerDefinitions() != null)
sb.append("ContainerDefinitions: " + getContainerDefinitions()
+ ",");
if (getFamily() != null)
sb.append("Family: " + getFamily() + ",");
if (getRevision() != null)
sb.append("Revision: " + getRevision() + ",");
if (getVolumes() != null)
sb.append("Volumes: " + getVolumes() + ",");
if (getStatus() != null)
sb.append("Status: " + getStatus() + ",");
if (getRequiresAttributes() != null)
sb.append("RequiresAttributes: " + getRequiresAttributes());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TaskDefinition == false)
return false;
TaskDefinition other = (TaskDefinition) obj;
if (other.getTaskDefinitionArn() == null
^ this.getTaskDefinitionArn() == null)
return false;
if (other.getTaskDefinitionArn() != null
&& other.getTaskDefinitionArn().equals(
this.getTaskDefinitionArn()) == false)
return false;
if (other.getContainerDefinitions() == null
^ this.getContainerDefinitions() == null)
return false;
if (other.getContainerDefinitions() != null
&& other.getContainerDefinitions().equals(
this.getContainerDefinitions()) == false)
return false;
if (other.getFamily() == null ^ this.getFamily() == null)
return false;
if (other.getFamily() != null
&& other.getFamily().equals(this.getFamily()) == false)
return false;
if (other.getRevision() == null ^ this.getRevision() == null)
return false;
if (other.getRevision() != null
&& other.getRevision().equals(this.getRevision()) == false)
return false;
if (other.getVolumes() == null ^ this.getVolumes() == null)
return false;
if (other.getVolumes() != null
&& other.getVolumes().equals(this.getVolumes()) == 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.getRequiresAttributes() == null
^ this.getRequiresAttributes() == null)
return false;
if (other.getRequiresAttributes() != null
&& other.getRequiresAttributes().equals(
this.getRequiresAttributes()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getTaskDefinitionArn() == null) ? 0
: getTaskDefinitionArn().hashCode());
hashCode = prime
* hashCode
+ ((getContainerDefinitions() == null) ? 0
: getContainerDefinitions().hashCode());
hashCode = prime * hashCode
+ ((getFamily() == null) ? 0 : getFamily().hashCode());
hashCode = prime * hashCode
+ ((getRevision() == null) ? 0 : getRevision().hashCode());
hashCode = prime * hashCode
+ ((getVolumes() == null) ? 0 : getVolumes().hashCode());
hashCode = prime * hashCode
+ ((getStatus() == null) ? 0 : getStatus().hashCode());
hashCode = prime
* hashCode
+ ((getRequiresAttributes() == null) ? 0
: getRequiresAttributes().hashCode());
return hashCode;
}
@Override
public TaskDefinition clone() {
try {
return (TaskDefinition) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}