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;
 

The name of a container in a task definition and the command it should run instead of its default.

 
 public class ContainerOverride implements SerializableCloneable {

    
The name of the container that receives the override.
 
     private String name;

    
The command to send to the container that overrides the default command from the Docker image or the task definition.
 
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition.
 
The name of the container that receives the override.

Returns:
The name of the container that receives the override.
 
     public String getName() {
         return ;
     }
    
    
The name of the container that receives the override.

Parameters:
name The name of the container that receives the override.
 
     public void setName(String name) {
         this. = name;
     }
    
    
The name of the container that receives the override.

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

Parameters:
name The name of the container that receives the override.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public ContainerOverride withName(String name) {
         this. = name;
         return this;
     }

    
The command to send to the container that overrides the default command from the Docker image or the task definition.

Returns:
The command to send to the container that overrides the default command from the Docker image or the task definition.
 
     public java.util.List<StringgetCommand() {
         if ( == null) {
                = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
               .setAutoConstruct(true);
         }
         return ;
     }
    
    
The command to send to the container that overrides the default command from the Docker image or the task definition.

Parameters:
command The command to send to the container that overrides the default command from the Docker image or the task definition.
    public void setCommand(java.util.Collection<Stringcommand) {
        if (command == null) {
            this. = null;
            return;
        }
        commandCopy.addAll(command);
        this. = commandCopy;
    }
    
    
The command to send to the container that overrides the default command from the Docker image or the task definition.

NOTE: This method appends the values to the existing list (if any). Use setCommand(java.util.Collection) or withCommand(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:
command The command to send to the container that overrides the default command from the Docker image or the task definition.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ContainerOverride withCommand(String... command) {
        if (getCommand() == nullsetCommand(new java.util.ArrayList<String>(command.length));
        for (String value : command) {
            getCommand().add(value);
        }
        return this;
    }
    
    
The command to send to the container that overrides the default command from the Docker image or the task definition.

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

Parameters:
command The command to send to the container that overrides the default command from the Docker image or the task definition.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (command == null) {
            this. = null;
        } else {
            commandCopy.addAll(command);
            this. = commandCopy;
        }
        return this;
    }

    
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition.

Returns:
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition.

Parameters:
environment The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition.
    public void setEnvironment(java.util.Collection<KeyValuePairenvironment) {
        if (environment == null) {
            this. = null;
            return;
        }
        environmentCopy.addAll(environment);
        this. = environmentCopy;
    }
    
    
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition.

NOTE: This method appends the values to the existing list (if any). Use setEnvironment(java.util.Collection) or withEnvironment(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:
environment The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ContainerOverride withEnvironment(KeyValuePair... environment) {
        if (getEnvironment() == nullsetEnvironment(new java.util.ArrayList<KeyValuePair>(environment.length));
        for (KeyValuePair value : environment) {
            getEnvironment().add(value);
        }
        return this;
    }
    
    
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition.

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

Parameters:
environment The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (environment == null) {
            this. = null;
        } else {
            environmentCopy.addAll(environment);
            this. = environmentCopy;
        }
        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 (getName() != nullsb.append("Name: " + getName() + ",");
        if (getCommand() != nullsb.append("Command: " + getCommand() + ",");
        if (getEnvironment() != nullsb.append("Environment: " + getEnvironment() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); 
        hashCode = prime * hashCode + ((getCommand() == null) ? 0 : getCommand().hashCode()); 
        hashCode = prime * hashCode + ((getEnvironment() == null) ? 0 : getEnvironment().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof ContainerOverride == falsereturn false;
        ContainerOverride other = (ContainerOverride)obj;
        
        if (other.getName() == null ^ this.getName() == nullreturn false;
        if (other.getName() != null && other.getName().equals(this.getName()) == falsereturn false
        if (other.getCommand() == null ^ this.getCommand() == nullreturn false;
        if (other.getCommand() != null && other.getCommand().equals(this.getCommand()) == falsereturn false
        if (other.getEnvironment() == null ^ this.getEnvironment() == nullreturn false;
        if (other.getEnvironment() != null && other.getEnvironment().equals(this.getEnvironment()) == falsereturn false
        return true;
    }
    
    @Override
    public ContainerOverride clone() {
        try {
            return (ContainerOverridesuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X