com.amazonaws.services.ecs.model.RunTaskRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ecs Show documentation
/*
* Copyright 2012-2017 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;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class RunTaskRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* The short name or full Amazon Resource Name (ARN) of the cluster on which to run your task. If you do not specify
* a cluster, the default cluster is assumed.
*
*/
private String cluster;
/**
*
* The family
and revision
(family:revision
) or full Amazon Resource Name
* (ARN) of the task definition to run. If a revision
is not specified, the latest ACTIVE
* revision is used.
*
*/
private String taskDefinition;
/**
*
* A list of container overrides in JSON format that specify the name of a container in the specified task
* definition and the overrides it should receive. You can override the default command for a container (that is
* specified in the task definition or Docker image) with a command
override. You can also override
* existing environment variables (that are specified in the task definition or Docker image) on a container or add
* new environment variables to it with an environment
override.
*
*
*
* A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the
* override structure.
*
*
*/
private TaskOverride overrides;
/**
*
* The number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks per
* call.
*
*/
private Integer count;
/**
*
* An optional tag specified when a task is started. For example if you automatically trigger a task to run a batch
* process job, you could apply a unique identifier for that job to your task with the startedBy
* parameter. You can then identify which tasks belong to that job by filtering the results of a ListTasks
* call with the startedBy
value. Up to 36 letters (uppercase and lowercase), numbers, hyphens, and
* underscores are allowed.
*
*
* If a task is started by an Amazon ECS service, then the startedBy
parameter contains the deployment
* ID of the service that starts it.
*
*/
private String startedBy;
/**
*
* The name of the task group to associate with the task. The default value is the family name of the task
* definition (for example, family:my-family-name).
*
*/
private String group;
/**
*
* An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task
* (including constraints in the task definition and those specified at run time).
*
*/
private com.amazonaws.internal.SdkInternalList placementConstraints;
/**
*
* The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules per task.
*
*/
private com.amazonaws.internal.SdkInternalList placementStrategy;
/**
*
* The short name or full Amazon Resource Name (ARN) of the cluster on which to run your task. If you do not specify
* a cluster, the default cluster is assumed.
*
*
* @param cluster
* The short name or full Amazon Resource Name (ARN) of the cluster on which to run your task. If you do not
* specify a cluster, the default cluster is assumed.
*/
public void setCluster(String cluster) {
this.cluster = cluster;
}
/**
*
* The short name or full Amazon Resource Name (ARN) of the cluster on which to run your task. If you do not specify
* a cluster, the default cluster is assumed.
*
*
* @return The short name or full Amazon Resource Name (ARN) of the cluster on which to run your task. If you do not
* specify a cluster, the default cluster is assumed.
*/
public String getCluster() {
return this.cluster;
}
/**
*
* The short name or full Amazon Resource Name (ARN) of the cluster on which to run your task. If you do not specify
* a cluster, the default cluster is assumed.
*
*
* @param cluster
* The short name or full Amazon Resource Name (ARN) of the cluster on which to run your task. If you do not
* specify a cluster, the default cluster is assumed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RunTaskRequest withCluster(String cluster) {
setCluster(cluster);
return this;
}
/**
*
* The family
and revision
(family:revision
) or full Amazon Resource Name
* (ARN) of the task definition to run. If a revision
is not specified, the latest ACTIVE
* revision is used.
*
*
* @param taskDefinition
* The family
and revision
(family:revision
) or full Amazon Resource
* Name (ARN) of the task definition to run. If a revision
is not specified, the latest
* ACTIVE
revision is used.
*/
public void setTaskDefinition(String taskDefinition) {
this.taskDefinition = taskDefinition;
}
/**
*
* The family
and revision
(family:revision
) or full Amazon Resource Name
* (ARN) of the task definition to run. If a revision
is not specified, the latest ACTIVE
* revision is used.
*
*
* @return The family
and revision
(family:revision
) or full Amazon Resource
* Name (ARN) of the task definition to run. If a revision
is not specified, the latest
* ACTIVE
revision is used.
*/
public String getTaskDefinition() {
return this.taskDefinition;
}
/**
*
* The family
and revision
(family:revision
) or full Amazon Resource Name
* (ARN) of the task definition to run. If a revision
is not specified, the latest ACTIVE
* revision is used.
*
*
* @param taskDefinition
* The family
and revision
(family:revision
) or full Amazon Resource
* Name (ARN) of the task definition to run. If a revision
is not specified, the latest
* ACTIVE
revision is used.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RunTaskRequest withTaskDefinition(String taskDefinition) {
setTaskDefinition(taskDefinition);
return this;
}
/**
*
* A list of container overrides in JSON format that specify the name of a container in the specified task
* definition and the overrides it should receive. You can override the default command for a container (that is
* specified in the task definition or Docker image) with a command
override. You can also override
* existing environment variables (that are specified in the task definition or Docker image) on a container or add
* new environment variables to it with an environment
override.
*
*
*
* A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the
* override structure.
*
*
*
* @param overrides
* A list of container overrides in JSON format that specify the name of a container in the specified task
* definition and the overrides it should receive. You can override the default command for a container (that
* is specified in the task definition or Docker image) with a command
override. You can also
* override existing environment variables (that are specified in the task definition or Docker image) on a
* container or add new environment variables to it with an environment
override.
*
* A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters
* of the override structure.
*
*/
public void setOverrides(TaskOverride overrides) {
this.overrides = overrides;
}
/**
*
* A list of container overrides in JSON format that specify the name of a container in the specified task
* definition and the overrides it should receive. You can override the default command for a container (that is
* specified in the task definition or Docker image) with a command
override. You can also override
* existing environment variables (that are specified in the task definition or Docker image) on a container or add
* new environment variables to it with an environment
override.
*
*
*
* A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the
* override structure.
*
*
*
* @return A list of container overrides in JSON format that specify the name of a container in the specified task
* definition and the overrides it should receive. You can override the default command for a container
* (that is specified in the task definition or Docker image) with a command
override. You can
* also override existing environment variables (that are specified in the task definition or Docker image)
* on a container or add new environment variables to it with an environment
override.
*
*
* A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters
* of the override structure.
*
*/
public TaskOverride getOverrides() {
return this.overrides;
}
/**
*
* A list of container overrides in JSON format that specify the name of a container in the specified task
* definition and the overrides it should receive. You can override the default command for a container (that is
* specified in the task definition or Docker image) with a command
override. You can also override
* existing environment variables (that are specified in the task definition or Docker image) on a container or add
* new environment variables to it with an environment
override.
*
*
*
* A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the
* override structure.
*
*
*
* @param overrides
* A list of container overrides in JSON format that specify the name of a container in the specified task
* definition and the overrides it should receive. You can override the default command for a container (that
* is specified in the task definition or Docker image) with a command
override. You can also
* override existing environment variables (that are specified in the task definition or Docker image) on a
* container or add new environment variables to it with an environment
override.
*
* A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters
* of the override structure.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RunTaskRequest withOverrides(TaskOverride overrides) {
setOverrides(overrides);
return this;
}
/**
*
* The number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks per
* call.
*
*
* @param count
* The number of instantiations of the specified task to place on your cluster. You can specify up to 10
* tasks per call.
*/
public void setCount(Integer count) {
this.count = count;
}
/**
*
* The number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks per
* call.
*
*
* @return The number of instantiations of the specified task to place on your cluster. You can specify up to 10
* tasks per call.
*/
public Integer getCount() {
return this.count;
}
/**
*
* The number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks per
* call.
*
*
* @param count
* The number of instantiations of the specified task to place on your cluster. You can specify up to 10
* tasks per call.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RunTaskRequest withCount(Integer count) {
setCount(count);
return this;
}
/**
*
* An optional tag specified when a task is started. For example if you automatically trigger a task to run a batch
* process job, you could apply a unique identifier for that job to your task with the startedBy
* parameter. You can then identify which tasks belong to that job by filtering the results of a ListTasks
* call with the startedBy
value. Up to 36 letters (uppercase and lowercase), numbers, hyphens, and
* underscores are allowed.
*
*
* If a task is started by an Amazon ECS service, then the startedBy
parameter contains the deployment
* ID of the service that starts it.
*
*
* @param startedBy
* An optional tag specified when a task is started. For example if you automatically trigger a task to run a
* batch process job, you could apply a unique identifier for that job to your task with the
* startedBy
parameter. You can then identify which tasks belong to that job by filtering the
* results of a ListTasks call with the startedBy
value. Up to 36 letters (uppercase and
* lowercase), numbers, hyphens, and underscores are allowed.
*
* If a task is started by an Amazon ECS service, then the startedBy
parameter contains the
* deployment ID of the service that starts it.
*/
public void setStartedBy(String startedBy) {
this.startedBy = startedBy;
}
/**
*
* An optional tag specified when a task is started. For example if you automatically trigger a task to run a batch
* process job, you could apply a unique identifier for that job to your task with the startedBy
* parameter. You can then identify which tasks belong to that job by filtering the results of a ListTasks
* call with the startedBy
value. Up to 36 letters (uppercase and lowercase), numbers, hyphens, and
* underscores are allowed.
*
*
* If a task is started by an Amazon ECS service, then the startedBy
parameter contains the deployment
* ID of the service that starts it.
*
*
* @return An optional tag specified when a task is started. For example if you automatically trigger a task to run
* a batch process job, you could apply a unique identifier for that job to your task with the
* startedBy
parameter. You can then identify which tasks belong to that job by filtering the
* results of a ListTasks call with the startedBy
value. Up to 36 letters (uppercase and
* lowercase), numbers, hyphens, and underscores are allowed.
*
* If a task is started by an Amazon ECS service, then the startedBy
parameter contains the
* deployment ID of the service that starts it.
*/
public String getStartedBy() {
return this.startedBy;
}
/**
*
* An optional tag specified when a task is started. For example if you automatically trigger a task to run a batch
* process job, you could apply a unique identifier for that job to your task with the startedBy
* parameter. You can then identify which tasks belong to that job by filtering the results of a ListTasks
* call with the startedBy
value. Up to 36 letters (uppercase and lowercase), numbers, hyphens, and
* underscores are allowed.
*
*
* If a task is started by an Amazon ECS service, then the startedBy
parameter contains the deployment
* ID of the service that starts it.
*
*
* @param startedBy
* An optional tag specified when a task is started. For example if you automatically trigger a task to run a
* batch process job, you could apply a unique identifier for that job to your task with the
* startedBy
parameter. You can then identify which tasks belong to that job by filtering the
* results of a ListTasks call with the startedBy
value. Up to 36 letters (uppercase and
* lowercase), numbers, hyphens, and underscores are allowed.
*
* If a task is started by an Amazon ECS service, then the startedBy
parameter contains the
* deployment ID of the service that starts it.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RunTaskRequest withStartedBy(String startedBy) {
setStartedBy(startedBy);
return this;
}
/**
*
* The name of the task group to associate with the task. The default value is the family name of the task
* definition (for example, family:my-family-name).
*
*
* @param group
* The name of the task group to associate with the task. The default value is the family name of the task
* definition (for example, family:my-family-name).
*/
public void setGroup(String group) {
this.group = group;
}
/**
*
* The name of the task group to associate with the task. The default value is the family name of the task
* definition (for example, family:my-family-name).
*
*
* @return The name of the task group to associate with the task. The default value is the family name of the task
* definition (for example, family:my-family-name).
*/
public String getGroup() {
return this.group;
}
/**
*
* The name of the task group to associate with the task. The default value is the family name of the task
* definition (for example, family:my-family-name).
*
*
* @param group
* The name of the task group to associate with the task. The default value is the family name of the task
* definition (for example, family:my-family-name).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RunTaskRequest withGroup(String group) {
setGroup(group);
return this;
}
/**
*
* An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task
* (including constraints in the task definition and those specified at run time).
*
*
* @return An array of placement constraint objects to use for the task. You can specify up to 10 constraints per
* task (including constraints in the task definition and those specified at run time).
*/
public java.util.List getPlacementConstraints() {
if (placementConstraints == null) {
placementConstraints = new com.amazonaws.internal.SdkInternalList();
}
return placementConstraints;
}
/**
*
* An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task
* (including constraints in the task definition and those specified at run time).
*
*
* @param placementConstraints
* An array of placement constraint objects to use for the task. You can specify up to 10 constraints per
* task (including constraints in the task definition and those specified at run time).
*/
public void setPlacementConstraints(java.util.Collection placementConstraints) {
if (placementConstraints == null) {
this.placementConstraints = null;
return;
}
this.placementConstraints = new com.amazonaws.internal.SdkInternalList(placementConstraints);
}
/**
*
* An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task
* (including constraints in the task definition and those specified at run time).
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setPlacementConstraints(java.util.Collection)} or {@link #withPlacementConstraints(java.util.Collection)}
* if you want to override the existing values.
*
*
* @param placementConstraints
* An array of placement constraint objects to use for the task. You can specify up to 10 constraints per
* task (including constraints in the task definition and those specified at run time).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RunTaskRequest withPlacementConstraints(PlacementConstraint... placementConstraints) {
if (this.placementConstraints == null) {
setPlacementConstraints(new com.amazonaws.internal.SdkInternalList(placementConstraints.length));
}
for (PlacementConstraint ele : placementConstraints) {
this.placementConstraints.add(ele);
}
return this;
}
/**
*
* An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task
* (including constraints in the task definition and those specified at run time).
*
*
* @param placementConstraints
* An array of placement constraint objects to use for the task. You can specify up to 10 constraints per
* task (including constraints in the task definition and those specified at run time).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RunTaskRequest withPlacementConstraints(java.util.Collection placementConstraints) {
setPlacementConstraints(placementConstraints);
return this;
}
/**
*
* The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules per task.
*
*
* @return The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules per
* task.
*/
public java.util.List getPlacementStrategy() {
if (placementStrategy == null) {
placementStrategy = new com.amazonaws.internal.SdkInternalList();
}
return placementStrategy;
}
/**
*
* The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules per task.
*
*
* @param placementStrategy
* The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules per
* task.
*/
public void setPlacementStrategy(java.util.Collection placementStrategy) {
if (placementStrategy == null) {
this.placementStrategy = null;
return;
}
this.placementStrategy = new com.amazonaws.internal.SdkInternalList(placementStrategy);
}
/**
*
* The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules per task.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setPlacementStrategy(java.util.Collection)} or {@link #withPlacementStrategy(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param placementStrategy
* The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules per
* task.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RunTaskRequest withPlacementStrategy(PlacementStrategy... placementStrategy) {
if (this.placementStrategy == null) {
setPlacementStrategy(new com.amazonaws.internal.SdkInternalList(placementStrategy.length));
}
for (PlacementStrategy ele : placementStrategy) {
this.placementStrategy.add(ele);
}
return this;
}
/**
*
* The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules per task.
*
*
* @param placementStrategy
* The placement strategy objects to use for the task. You can specify a maximum of 5 strategy rules per
* task.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RunTaskRequest withPlacementStrategy(java.util.Collection placementStrategy) {
setPlacementStrategy(placementStrategy);
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 (getCluster() != null)
sb.append("Cluster: ").append(getCluster()).append(",");
if (getTaskDefinition() != null)
sb.append("TaskDefinition: ").append(getTaskDefinition()).append(",");
if (getOverrides() != null)
sb.append("Overrides: ").append(getOverrides()).append(",");
if (getCount() != null)
sb.append("Count: ").append(getCount()).append(",");
if (getStartedBy() != null)
sb.append("StartedBy: ").append(getStartedBy()).append(",");
if (getGroup() != null)
sb.append("Group: ").append(getGroup()).append(",");
if (getPlacementConstraints() != null)
sb.append("PlacementConstraints: ").append(getPlacementConstraints()).append(",");
if (getPlacementStrategy() != null)
sb.append("PlacementStrategy: ").append(getPlacementStrategy());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof RunTaskRequest == false)
return false;
RunTaskRequest other = (RunTaskRequest) obj;
if (other.getCluster() == null ^ this.getCluster() == null)
return false;
if (other.getCluster() != null && other.getCluster().equals(this.getCluster()) == false)
return false;
if (other.getTaskDefinition() == null ^ this.getTaskDefinition() == null)
return false;
if (other.getTaskDefinition() != null && other.getTaskDefinition().equals(this.getTaskDefinition()) == false)
return false;
if (other.getOverrides() == null ^ this.getOverrides() == null)
return false;
if (other.getOverrides() != null && other.getOverrides().equals(this.getOverrides()) == false)
return false;
if (other.getCount() == null ^ this.getCount() == null)
return false;
if (other.getCount() != null && other.getCount().equals(this.getCount()) == false)
return false;
if (other.getStartedBy() == null ^ this.getStartedBy() == null)
return false;
if (other.getStartedBy() != null && other.getStartedBy().equals(this.getStartedBy()) == false)
return false;
if (other.getGroup() == null ^ this.getGroup() == null)
return false;
if (other.getGroup() != null && other.getGroup().equals(this.getGroup()) == false)
return false;
if (other.getPlacementConstraints() == null ^ this.getPlacementConstraints() == null)
return false;
if (other.getPlacementConstraints() != null && other.getPlacementConstraints().equals(this.getPlacementConstraints()) == false)
return false;
if (other.getPlacementStrategy() == null ^ this.getPlacementStrategy() == null)
return false;
if (other.getPlacementStrategy() != null && other.getPlacementStrategy().equals(this.getPlacementStrategy()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getCluster() == null) ? 0 : getCluster().hashCode());
hashCode = prime * hashCode + ((getTaskDefinition() == null) ? 0 : getTaskDefinition().hashCode());
hashCode = prime * hashCode + ((getOverrides() == null) ? 0 : getOverrides().hashCode());
hashCode = prime * hashCode + ((getCount() == null) ? 0 : getCount().hashCode());
hashCode = prime * hashCode + ((getStartedBy() == null) ? 0 : getStartedBy().hashCode());
hashCode = prime * hashCode + ((getGroup() == null) ? 0 : getGroup().hashCode());
hashCode = prime * hashCode + ((getPlacementConstraints() == null) ? 0 : getPlacementConstraints().hashCode());
hashCode = prime * hashCode + ((getPlacementStrategy() == null) ? 0 : getPlacementStrategy().hashCode());
return hashCode;
}
@Override
public RunTaskRequest clone() {
return (RunTaskRequest) super.clone();
}
}