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;
 
 
Container for the parameters to the StartTask operation.

Starts a new task from the specified task definition on the specified container instance or instances. If you want to use the default Amazon ECS scheduler to place your task, use RunTask instead.

IMPORTANT: The list of container instances to start tasks on is limited to 10.

 
 public class StartTaskRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The short name or full Amazon Resource Name (ARN) of the cluster that you want to start your task on. 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 that you want to start. 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. <note>

A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the override structure. </note>

 
     private TaskOverride overrides;

    
The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task. <important>

The list of container instances to start tasks on is limited to 10. </important>

 
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.

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 short name or full Amazon Resource Name (ARN) of the cluster that you want to start your task on. If you do not specify a cluster, the default cluster is assumed..

Returns:
The short name or full Amazon Resource Name (ARN) of the cluster that you want to start your task on. If you do not specify a cluster, the default cluster is assumed..
 
     public String getCluster() {
         return ;
     }
    
    
The short name or full Amazon Resource Name (ARN) of the cluster that you want to start your task on. If you do not specify a cluster, the default cluster is assumed..

Parameters:
cluster The short name or full Amazon Resource Name (ARN) of the cluster that you want to start your task on. If you do not specify a cluster, the default cluster is assumed..
    public void setCluster(String cluster) {
        this. = cluster;
    }
    
    
The short name or full Amazon Resource Name (ARN) of the cluster that you want to start your task on. If you do not specify a cluster, the default cluster is assumed..

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

Parameters:
cluster The short name or full Amazon Resource Name (ARN) of the cluster that you want to start your task on. If you do not specify a cluster, the default cluster is assumed..
Returns:
A reference to this updated object so that method calls can be chained together.
    public StartTaskRequest withCluster(String cluster) {
        this. = cluster;
        return this;
    }

    
The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to start. If a revision is not specified, the latest ACTIVE revision is used.

Returns:
The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to start. If a revision is not specified, the latest ACTIVE revision is used.
    public String getTaskDefinition() {
        return ;
    }
    
    
The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to start. If a revision is not specified, the latest ACTIVE revision is used.

Parameters:
taskDefinition The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to start. If a revision is not specified, the latest ACTIVE revision is used.
    public void setTaskDefinition(String taskDefinition) {
        this. = taskDefinition;
    }
    
    
The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to start. If a revision is not specified, the latest ACTIVE revision is used.

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

Parameters:
taskDefinition The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task definition that you want to start. If a revision is not specified, the latest ACTIVE revision is used.
Returns:
A reference to this updated object so that method calls can be chained together.
    public StartTaskRequest withTaskDefinition(String taskDefinition) {
        this. = 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. <note>

A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the override structure. </note>

Returns:
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. <note>

A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the override structure. </note>

    public TaskOverride getOverrides() {
        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. <note>

A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the override structure. </note>

Parameters:
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. <note>

A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the override structure. </note>

    public void setOverrides(TaskOverride overrides) {
        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. <note>

A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the override structure. </note>

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

Parameters:
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. <note>

A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the override structure. </note>

Returns:
A reference to this updated object so that method calls can be chained together.
    public StartTaskRequest withOverrides(TaskOverride overrides) {
        this. = overrides;
        return this;
    }

    
The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task. <important>

The list of container instances to start tasks on is limited to 10. </important>

Returns:
The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task. <important>

The list of container instances to start tasks on is limited to 10. </important>

        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task. <important>

The list of container instances to start tasks on is limited to 10. </important>

Parameters:
containerInstances The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task. <important>

The list of container instances to start tasks on is limited to 10. </important>

    public void setContainerInstances(java.util.Collection<StringcontainerInstances) {
        if (containerInstances == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<StringcontainerInstancesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(containerInstances.size());
        containerInstancesCopy.addAll(containerInstances);
        this. = containerInstancesCopy;
    }
    
    
The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task. <important>

The list of container instances to start tasks on is limited to 10. </important>

NOTE: This method appends the values to the existing list (if any). Use setContainerInstances(java.util.Collection) or withContainerInstances(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:
containerInstances The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task. <important>

The list of container instances to start tasks on is limited to 10. </important>

Returns:
A reference to this updated object so that method calls can be chained together.
    public StartTaskRequest withContainerInstances(String... containerInstances) {
        if (getContainerInstances() == nullsetContainerInstances(new java.util.ArrayList<String>(containerInstances.length));
        for (String value : containerInstances) {
            getContainerInstances().add(value);
        }
        return this;
    }
    
    
The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task. <important>

The list of container instances to start tasks on is limited to 10. </important>

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

Parameters:
containerInstances The container instance UUIDs or full Amazon Resource Name (ARN) entries for the container instances on which you would like to place your task. <important>

The list of container instances to start tasks on is limited to 10. </important>

Returns:
A reference to this updated object so that method calls can be chained together.
    public StartTaskRequest withContainerInstances(java.util.Collection<StringcontainerInstances) {
        if (containerInstances == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringcontainerInstancesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(containerInstances.size());
            containerInstancesCopy.addAll(containerInstances);
            this. = containerInstancesCopy;
        }
        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.

If a task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.

Returns:
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.

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 ;
    }
    
    
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.

If a task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.

Parameters:
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.

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;
    }
    
    
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.

If a task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.

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

Parameters:
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.

If a task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.

Returns:
A reference to this updated object so that method calls can be chained together.
    public StartTaskRequest withStartedBy(String startedBy) {
        this. = startedBy;
        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 (getCluster() != nullsb.append("Cluster: " + getCluster() + ",");
        if (getTaskDefinition() != nullsb.append("TaskDefinition: " + getTaskDefinition() + ",");
        if (getOverrides() != nullsb.append("Overrides: " + getOverrides() + ",");
        if (getContainerInstances() != nullsb.append("ContainerInstances: " + getContainerInstances() + ",");
        if (getStartedBy() != nullsb.append("StartedBy: " + getStartedBy() );
        sb.append("}");
        return sb.toString();
    }
    
    @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 + ((getContainerInstances() == null) ? 0 : getContainerInstances().hashCode()); 
        hashCode = prime * hashCode + ((getStartedBy() == null) ? 0 : getStartedBy().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof StartTaskRequest == falsereturn false;
        StartTaskRequest other = (StartTaskRequest)obj;
        
        if (other.getCluster() == null ^ this.getCluster() == nullreturn false;
        if (other.getCluster() != null && other.getCluster().equals(this.getCluster()) == falsereturn false
        if (other.getTaskDefinition() == null ^ this.getTaskDefinition() == nullreturn false;
        if (other.getTaskDefinition() != null && other.getTaskDefinition().equals(this.getTaskDefinition()) == falsereturn false
        if (other.getOverrides() == null ^ this.getOverrides() == nullreturn false;
        if (other.getOverrides() != null && other.getOverrides().equals(this.getOverrides()) == falsereturn false
        if (other.getContainerInstances() == null ^ this.getContainerInstances() == nullreturn false;
        if (other.getContainerInstances() != null && other.getContainerInstances().equals(this.getContainerInstances()) == falsereturn false
        if (other.getStartedBy() == null ^ this.getStartedBy() == nullreturn false;
        if (other.getStartedBy() != null && other.getStartedBy().equals(this.getStartedBy()) == falsereturn false
        return true;
    }
    
    @Override
    public StartTaskRequest clone() {
        
            return (StartTaskRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X