/* * Copyright 2018-2023 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.batch.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* Object representing any Kubernetes overrides to a job definition that's used in a SubmitJob API operation. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class EksContainerOverride implements Serializable, Cloneable, StructuredPojo { /** ** The override of the Docker image that's used to start the container. *
*/ private String image; /** ** The command to send to the container that overrides the default command from the Docker image or the job * definition. *
*/ private java.util.List* The arguments to the entrypoint to send to the container that overrides the default arguments from the Docker * image or the job definition. For more information, see CMD in the Dockerfile reference and Define a * command an arguments for a pod in the Kubernetes documentation. *
*/ private java.util.List* 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 job * definition. *
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* The type and amount of resources to assign to a container. These override the settings in the job definition. The
* supported resources include memory
, cpu
, and nvidia.com/gpu
. For more
* information, see Resource management for
* pods and containers in the Kubernetes documentation.
*
* The override of the Docker image that's used to start the container. *
* * @param image * The override of the Docker image that's used to start the container. */ public void setImage(String image) { this.image = image; } /** ** The override of the Docker image that's used to start the container. *
* * @return The override of the Docker image that's used to start the container. */ public String getImage() { return this.image; } /** ** The override of the Docker image that's used to start the container. *
* * @param image * The override of the Docker image that's used to start the container. * @return Returns a reference to this object so that method calls can be chained together. */ public EksContainerOverride withImage(String image) { setImage(image); return this; } /** ** The command to send to the container that overrides the default command from the Docker image or the job * definition. *
* * @return The command to send to the container that overrides the default command from the Docker image or the job * definition. */ public java.util.List* The command to send to the container that overrides the default command from the Docker image or the job * definition. *
* * @param command * The command to send to the container that overrides the default command from the Docker image or the job * definition. */ public void setCommand(java.util.Collection* The command to send to the container that overrides the default command from the Docker image or the job * definition. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setCommand(java.util.Collection)} or {@link #withCommand(java.util.Collection)} if you want to override * the existing values. *
* * @param command * The command to send to the container that overrides the default command from the Docker image or the job * definition. * @return Returns a reference to this object so that method calls can be chained together. */ public EksContainerOverride withCommand(String... command) { if (this.command == null) { setCommand(new java.util.ArrayList* The command to send to the container that overrides the default command from the Docker image or the job * definition. *
* * @param command * The command to send to the container that overrides the default command from the Docker image or the job * definition. * @return Returns a reference to this object so that method calls can be chained together. */ public EksContainerOverride withCommand(java.util.Collection* The arguments to the entrypoint to send to the container that overrides the default arguments from the Docker * image or the job definition. For more information, see CMD in the Dockerfile reference and Define a * command an arguments for a pod in the Kubernetes documentation. *
* * @return The arguments to the entrypoint to send to the container that overrides the default arguments from the * Docker image or the job definition. For more information, see CMD in the Dockerfile reference * and Define * a command an arguments for a pod in the Kubernetes documentation. */ public java.util.List* The arguments to the entrypoint to send to the container that overrides the default arguments from the Docker * image or the job definition. For more information, see CMD in the Dockerfile reference and Define a * command an arguments for a pod in the Kubernetes documentation. *
* * @param args * The arguments to the entrypoint to send to the container that overrides the default arguments from the * Docker image or the job definition. For more information, see CMD in the Dockerfile reference * and * Define a command an arguments for a pod in the Kubernetes documentation. */ public void setArgs(java.util.Collection* The arguments to the entrypoint to send to the container that overrides the default arguments from the Docker * image or the job definition. For more information, see CMD in the Dockerfile reference and Define a * command an arguments for a pod in the Kubernetes documentation. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setArgs(java.util.Collection)} or {@link #withArgs(java.util.Collection)} if you want to override the * existing values. *
* * @param args * The arguments to the entrypoint to send to the container that overrides the default arguments from the * Docker image or the job definition. For more information, see CMD in the Dockerfile reference * and * Define a command an arguments for a pod in the Kubernetes documentation. * @return Returns a reference to this object so that method calls can be chained together. */ public EksContainerOverride withArgs(String... args) { if (this.args == null) { setArgs(new java.util.ArrayList* The arguments to the entrypoint to send to the container that overrides the default arguments from the Docker * image or the job definition. For more information, see CMD in the Dockerfile reference and Define a * command an arguments for a pod in the Kubernetes documentation. *
* * @param args * The arguments to the entrypoint to send to the container that overrides the default arguments from the * Docker image or the job definition. For more information, see CMD in the Dockerfile reference * and * Define a command an arguments for a pod in the Kubernetes documentation. * @return Returns a reference to this object so that method calls can be chained together. */ public EksContainerOverride withArgs(java.util.Collection* 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 job * definition. *
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* 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 job * definition. *
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* 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 job * definition. *
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* NOTE: This method appends the values to the existing list (if any). Use * {@link #setEnv(java.util.Collection)} or {@link #withEnv(java.util.Collection)} if you want to override the * existing values. *
* * @param env * 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 job definition.
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* 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 job * definition. *
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* The type and amount of resources to assign to a container. These override the settings in the job definition. The
* supported resources include memory
, cpu
, and nvidia.com/gpu
. For more
* information, see Resource management for
* pods and containers in the Kubernetes documentation.
*
memory
, cpu
, and
* nvidia.com/gpu
. For more information, see Resource management
* for pods and containers in the Kubernetes documentation.
*/
public void setResources(EksContainerResourceRequirements resources) {
this.resources = resources;
}
/**
*
* The type and amount of resources to assign to a container. These override the settings in the job definition. The
* supported resources include memory
, cpu
, and nvidia.com/gpu
. For more
* information, see Resource management for
* pods and containers in the Kubernetes documentation.
*
memory
, cpu
, and
* nvidia.com/gpu
. For more information, see Resource management
* for pods and containers in the Kubernetes documentation.
*/
public EksContainerResourceRequirements getResources() {
return this.resources;
}
/**
*
* The type and amount of resources to assign to a container. These override the settings in the job definition. The
* supported resources include memory
, cpu
, and nvidia.com/gpu
. For more
* information, see Resource management for
* pods and containers in the Kubernetes documentation.
*
memory
, cpu
, and
* nvidia.com/gpu
. For more information, see Resource management
* for pods and containers in the Kubernetes documentation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EksContainerOverride withResources(EksContainerResourceRequirements resources) {
setResources(resources);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getImage() != null)
sb.append("Image: ").append(getImage()).append(",");
if (getCommand() != null)
sb.append("Command: ").append(getCommand()).append(",");
if (getArgs() != null)
sb.append("Args: ").append(getArgs()).append(",");
if (getEnv() != null)
sb.append("Env: ").append(getEnv()).append(",");
if (getResources() != null)
sb.append("Resources: ").append(getResources());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof EksContainerOverride == false)
return false;
EksContainerOverride other = (EksContainerOverride) obj;
if (other.getImage() == null ^ this.getImage() == null)
return false;
if (other.getImage() != null && other.getImage().equals(this.getImage()) == false)
return false;
if (other.getCommand() == null ^ this.getCommand() == null)
return false;
if (other.getCommand() != null && other.getCommand().equals(this.getCommand()) == false)
return false;
if (other.getArgs() == null ^ this.getArgs() == null)
return false;
if (other.getArgs() != null && other.getArgs().equals(this.getArgs()) == false)
return false;
if (other.getEnv() == null ^ this.getEnv() == null)
return false;
if (other.getEnv() != null && other.getEnv().equals(this.getEnv()) == false)
return false;
if (other.getResources() == null ^ this.getResources() == null)
return false;
if (other.getResources() != null && other.getResources().equals(this.getResources()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getImage() == null) ? 0 : getImage().hashCode());
hashCode = prime * hashCode + ((getCommand() == null) ? 0 : getCommand().hashCode());
hashCode = prime * hashCode + ((getArgs() == null) ? 0 : getArgs().hashCode());
hashCode = prime * hashCode + ((getEnv() == null) ? 0 : getEnv().hashCode());
hashCode = prime * hashCode + ((getResources() == null) ? 0 : getResources().hashCode());
return hashCode;
}
@Override
public EksContainerOverride clone() {
try {
return (EksContainerOverride) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.batch.model.transform.EksContainerOverrideMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}