com.amazonaws.services.batch.model.ContainerOverrides Maven / Gradle / Ivy
Show all versions of aws-java-sdk-batch Show documentation
/*
* Copyright 2019-2024 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;
/**
*
* The overrides that should be sent to a container.
*
*
* For information about using Batch overrides when you connect event sources to targets, see BatchContainerOverrides.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ContainerOverrides implements Serializable, Cloneable, StructuredPojo {
/**
*
* This parameter is deprecated, use resourceRequirements
to override the vcpus
parameter
* that's set in the job definition. It's not supported for jobs running on Fargate resources. For jobs that run on
* Amazon EC2 resources, it overrides the vcpus
parameter set in the job definition, but doesn't
* override any vCPU requirement specified in the resourceRequirements
structure in the job definition.
* To override vCPU requirements that are specified in the resourceRequirements
structure in the job
* definition, resourceRequirements
must be specified in the SubmitJob
request, with
* type
set to VCPU
and value
set to the new value. For more information, see
*
* Can't override job definition resource requirements in the Batch User Guide.
*
*/
@Deprecated
private Integer vcpus;
/**
*
* This parameter is deprecated, use resourceRequirements
to override the memory requirements specified
* in the job definition. It's not supported for jobs running on Fargate resources. For jobs that run on Amazon EC2
* resources, it overrides the memory
parameter set in the job definition, but doesn't override any
* memory requirement that's specified in the resourceRequirements
structure in the job definition. To
* override memory requirements that are specified in the resourceRequirements
structure in the job
* definition, resourceRequirements
must be specified in the SubmitJob
request, with
* type
set to MEMORY
and value
set to the new value. For more information,
* see Can't override job definition resource requirements in the Batch User Guide.
*
*/
@Deprecated
private Integer memory;
/**
*
* The command to send to the container that overrides the default command from the Docker image or the job
* definition.
*
*
*
* This parameter can't contain an empty string.
*
*
*/
private java.util.List command;
/**
*
* The instance type to use for a multi-node parallel job.
*
*
*
* This parameter isn't applicable to single-node container jobs or jobs that run on Fargate resources, and
* shouldn't be provided.
*
*
*/
private String instanceType;
/**
*
* 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.
*
*
*/
private java.util.List environment;
/**
*
* The type and amount of resources to assign to a container. This overrides the settings in the job definition. The
* supported resources include GPU
, MEMORY
, and VCPU
.
*
*/
private java.util.List resourceRequirements;
/**
*
* This parameter is deprecated, use resourceRequirements
to override the vcpus
parameter
* that's set in the job definition. It's not supported for jobs running on Fargate resources. For jobs that run on
* Amazon EC2 resources, it overrides the vcpus
parameter set in the job definition, but doesn't
* override any vCPU requirement specified in the resourceRequirements
structure in the job definition.
* To override vCPU requirements that are specified in the resourceRequirements
structure in the job
* definition, resourceRequirements
must be specified in the SubmitJob
request, with
* type
set to VCPU
and value
set to the new value. For more information, see
*
* Can't override job definition resource requirements in the Batch User Guide.
*
*
* @param vcpus
* This parameter is deprecated, use resourceRequirements
to override the vcpus
* parameter that's set in the job definition. It's not supported for jobs running on Fargate resources. For
* jobs that run on Amazon EC2 resources, it overrides the vcpus
parameter set in the job
* definition, but doesn't override any vCPU requirement specified in the resourceRequirements
* structure in the job definition. To override vCPU requirements that are specified in the
* resourceRequirements
structure in the job definition, resourceRequirements
must
* be specified in the SubmitJob
request, with type
set to VCPU
and
* value
set to the new value. For more information, see Can't override job definition resource requirements in the Batch User Guide.
*/
@Deprecated
public void setVcpus(Integer vcpus) {
this.vcpus = vcpus;
}
/**
*
* This parameter is deprecated, use resourceRequirements
to override the vcpus
parameter
* that's set in the job definition. It's not supported for jobs running on Fargate resources. For jobs that run on
* Amazon EC2 resources, it overrides the vcpus
parameter set in the job definition, but doesn't
* override any vCPU requirement specified in the resourceRequirements
structure in the job definition.
* To override vCPU requirements that are specified in the resourceRequirements
structure in the job
* definition, resourceRequirements
must be specified in the SubmitJob
request, with
* type
set to VCPU
and value
set to the new value. For more information, see
*
* Can't override job definition resource requirements in the Batch User Guide.
*
*
* @return This parameter is deprecated, use resourceRequirements
to override the vcpus
* parameter that's set in the job definition. It's not supported for jobs running on Fargate resources. For
* jobs that run on Amazon EC2 resources, it overrides the vcpus
parameter set in the job
* definition, but doesn't override any vCPU requirement specified in the resourceRequirements
* structure in the job definition. To override vCPU requirements that are specified in the
* resourceRequirements
structure in the job definition, resourceRequirements
must
* be specified in the SubmitJob
request, with type
set to VCPU
and
* value
set to the new value. For more information, see Can't override job definition resource requirements in the Batch User Guide.
*/
@Deprecated
public Integer getVcpus() {
return this.vcpus;
}
/**
*
* This parameter is deprecated, use resourceRequirements
to override the vcpus
parameter
* that's set in the job definition. It's not supported for jobs running on Fargate resources. For jobs that run on
* Amazon EC2 resources, it overrides the vcpus
parameter set in the job definition, but doesn't
* override any vCPU requirement specified in the resourceRequirements
structure in the job definition.
* To override vCPU requirements that are specified in the resourceRequirements
structure in the job
* definition, resourceRequirements
must be specified in the SubmitJob
request, with
* type
set to VCPU
and value
set to the new value. For more information, see
*
* Can't override job definition resource requirements in the Batch User Guide.
*
*
* @param vcpus
* This parameter is deprecated, use resourceRequirements
to override the vcpus
* parameter that's set in the job definition. It's not supported for jobs running on Fargate resources. For
* jobs that run on Amazon EC2 resources, it overrides the vcpus
parameter set in the job
* definition, but doesn't override any vCPU requirement specified in the resourceRequirements
* structure in the job definition. To override vCPU requirements that are specified in the
* resourceRequirements
structure in the job definition, resourceRequirements
must
* be specified in the SubmitJob
request, with type
set to VCPU
and
* value
set to the new value. For more information, see Can't override job definition resource requirements in the Batch User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
@Deprecated
public ContainerOverrides withVcpus(Integer vcpus) {
setVcpus(vcpus);
return this;
}
/**
*
* This parameter is deprecated, use resourceRequirements
to override the memory requirements specified
* in the job definition. It's not supported for jobs running on Fargate resources. For jobs that run on Amazon EC2
* resources, it overrides the memory
parameter set in the job definition, but doesn't override any
* memory requirement that's specified in the resourceRequirements
structure in the job definition. To
* override memory requirements that are specified in the resourceRequirements
structure in the job
* definition, resourceRequirements
must be specified in the SubmitJob
request, with
* type
set to MEMORY
and value
set to the new value. For more information,
* see Can't override job definition resource requirements in the Batch User Guide.
*
*
* @param memory
* This parameter is deprecated, use resourceRequirements
to override the memory requirements
* specified in the job definition. It's not supported for jobs running on Fargate resources. For jobs that
* run on Amazon EC2 resources, it overrides the memory
parameter set in the job definition, but
* doesn't override any memory requirement that's specified in the resourceRequirements
* structure in the job definition. To override memory requirements that are specified in the
* resourceRequirements
structure in the job definition, resourceRequirements
must
* be specified in the SubmitJob
request, with type
set to MEMORY
and
* value
set to the new value. For more information, see Can't override job definition resource requirements in the Batch User Guide.
*/
@Deprecated
public void setMemory(Integer memory) {
this.memory = memory;
}
/**
*
* This parameter is deprecated, use resourceRequirements
to override the memory requirements specified
* in the job definition. It's not supported for jobs running on Fargate resources. For jobs that run on Amazon EC2
* resources, it overrides the memory
parameter set in the job definition, but doesn't override any
* memory requirement that's specified in the resourceRequirements
structure in the job definition. To
* override memory requirements that are specified in the resourceRequirements
structure in the job
* definition, resourceRequirements
must be specified in the SubmitJob
request, with
* type
set to MEMORY
and value
set to the new value. For more information,
* see Can't override job definition resource requirements in the Batch User Guide.
*
*
* @return This parameter is deprecated, use resourceRequirements
to override the memory requirements
* specified in the job definition. It's not supported for jobs running on Fargate resources. For jobs that
* run on Amazon EC2 resources, it overrides the memory
parameter set in the job definition,
* but doesn't override any memory requirement that's specified in the resourceRequirements
* structure in the job definition. To override memory requirements that are specified in the
* resourceRequirements
structure in the job definition, resourceRequirements
must
* be specified in the SubmitJob
request, with type
set to MEMORY
and
* value
set to the new value. For more information, see Can't override job definition resource requirements in the Batch User Guide.
*/
@Deprecated
public Integer getMemory() {
return this.memory;
}
/**
*
* This parameter is deprecated, use resourceRequirements
to override the memory requirements specified
* in the job definition. It's not supported for jobs running on Fargate resources. For jobs that run on Amazon EC2
* resources, it overrides the memory
parameter set in the job definition, but doesn't override any
* memory requirement that's specified in the resourceRequirements
structure in the job definition. To
* override memory requirements that are specified in the resourceRequirements
structure in the job
* definition, resourceRequirements
must be specified in the SubmitJob
request, with
* type
set to MEMORY
and value
set to the new value. For more information,
* see Can't override job definition resource requirements in the Batch User Guide.
*
*
* @param memory
* This parameter is deprecated, use resourceRequirements
to override the memory requirements
* specified in the job definition. It's not supported for jobs running on Fargate resources. For jobs that
* run on Amazon EC2 resources, it overrides the memory
parameter set in the job definition, but
* doesn't override any memory requirement that's specified in the resourceRequirements
* structure in the job definition. To override memory requirements that are specified in the
* resourceRequirements
structure in the job definition, resourceRequirements
must
* be specified in the SubmitJob
request, with type
set to MEMORY
and
* value
set to the new value. For more information, see Can't override job definition resource requirements in the Batch User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
@Deprecated
public ContainerOverrides withMemory(Integer memory) {
setMemory(memory);
return this;
}
/**
*
* The command to send to the container that overrides the default command from the Docker image or the job
* definition.
*
*
*
* This parameter can't contain an empty string.
*
*
*
* @return The command to send to the container that overrides the default command from the Docker image or the job
* definition.
*
* This parameter can't contain an empty string.
*
*/
public java.util.List getCommand() {
return command;
}
/**
*
* The command to send to the container that overrides the default command from the Docker image or the job
* definition.
*
*
*
* This parameter can't contain an empty string.
*
*
*
* @param command
* The command to send to the container that overrides the default command from the Docker image or the job
* definition.
*
* This parameter can't contain an empty string.
*
*/
public void setCommand(java.util.Collection command) {
if (command == null) {
this.command = null;
return;
}
this.command = new java.util.ArrayList(command);
}
/**
*
* The command to send to the container that overrides the default command from the Docker image or the job
* definition.
*
*
*
* This parameter can't contain an empty string.
*
*
*
* 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.
*
* This parameter can't contain an empty string.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerOverrides withCommand(String... command) {
if (this.command == null) {
setCommand(new java.util.ArrayList(command.length));
}
for (String ele : command) {
this.command.add(ele);
}
return this;
}
/**
*
* The command to send to the container that overrides the default command from the Docker image or the job
* definition.
*
*
*
* This parameter can't contain an empty string.
*
*
*
* @param command
* The command to send to the container that overrides the default command from the Docker image or the job
* definition.
*
* This parameter can't contain an empty string.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerOverrides withCommand(java.util.Collection command) {
setCommand(command);
return this;
}
/**
*
* The instance type to use for a multi-node parallel job.
*
*
*
* This parameter isn't applicable to single-node container jobs or jobs that run on Fargate resources, and
* shouldn't be provided.
*
*
*
* @param instanceType
* The instance type to use for a multi-node parallel job.
*
* This parameter isn't applicable to single-node container jobs or jobs that run on Fargate resources, and
* shouldn't be provided.
*
*/
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
/**
*
* The instance type to use for a multi-node parallel job.
*
*
*
* This parameter isn't applicable to single-node container jobs or jobs that run on Fargate resources, and
* shouldn't be provided.
*
*
*
* @return The instance type to use for a multi-node parallel job.
*
* This parameter isn't applicable to single-node container jobs or jobs that run on Fargate resources, and
* shouldn't be provided.
*
*/
public String getInstanceType() {
return this.instanceType;
}
/**
*
* The instance type to use for a multi-node parallel job.
*
*
*
* This parameter isn't applicable to single-node container jobs or jobs that run on Fargate resources, and
* shouldn't be provided.
*
*
*
* @param instanceType
* The instance type to use for a multi-node parallel job.
*
* This parameter isn't applicable to single-node container jobs or jobs that run on Fargate resources, and
* shouldn't be provided.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerOverrides withInstanceType(String instanceType) {
setInstanceType(instanceType);
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 job
* definition.
*
*
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
*
*
* @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 job definition.
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
*/
public java.util.List getEnvironment() {
return 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 job
* definition.
*
*
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
*
*
* @param 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 job definition.
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
*/
public void setEnvironment(java.util.Collection environment) {
if (environment == null) {
this.environment = null;
return;
}
this.environment = new java.util.ArrayList(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 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 #setEnvironment(java.util.Collection)} or {@link #withEnvironment(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param 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 job definition.
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerOverrides withEnvironment(KeyValuePair... environment) {
if (this.environment == null) {
setEnvironment(new java.util.ArrayList(environment.length));
}
for (KeyValuePair ele : environment) {
this.environment.add(ele);
}
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 job
* definition.
*
*
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
*
*
* @param 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 job definition.
*
* Environment variables cannot start with "AWS_BATCH
". This naming convention is reserved for
* variables that Batch sets.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerOverrides withEnvironment(java.util.Collection environment) {
setEnvironment(environment);
return this;
}
/**
*
* The type and amount of resources to assign to a container. This overrides the settings in the job definition. The
* supported resources include GPU
, MEMORY
, and VCPU
.
*
*
* @return The type and amount of resources to assign to a container. This overrides the settings in the job
* definition. The supported resources include GPU
, MEMORY
, and VCPU
.
*/
public java.util.List getResourceRequirements() {
return resourceRequirements;
}
/**
*
* The type and amount of resources to assign to a container. This overrides the settings in the job definition. The
* supported resources include GPU
, MEMORY
, and VCPU
.
*
*
* @param resourceRequirements
* The type and amount of resources to assign to a container. This overrides the settings in the job
* definition. The supported resources include GPU
, MEMORY
, and VCPU
.
*/
public void setResourceRequirements(java.util.Collection resourceRequirements) {
if (resourceRequirements == null) {
this.resourceRequirements = null;
return;
}
this.resourceRequirements = new java.util.ArrayList(resourceRequirements);
}
/**
*
* The type and amount of resources to assign to a container. This overrides the settings in the job definition. The
* supported resources include GPU
, MEMORY
, and VCPU
.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setResourceRequirements(java.util.Collection)} or {@link #withResourceRequirements(java.util.Collection)}
* if you want to override the existing values.
*
*
* @param resourceRequirements
* The type and amount of resources to assign to a container. This overrides the settings in the job
* definition. The supported resources include GPU
, MEMORY
, and VCPU
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerOverrides withResourceRequirements(ResourceRequirement... resourceRequirements) {
if (this.resourceRequirements == null) {
setResourceRequirements(new java.util.ArrayList(resourceRequirements.length));
}
for (ResourceRequirement ele : resourceRequirements) {
this.resourceRequirements.add(ele);
}
return this;
}
/**
*
* The type and amount of resources to assign to a container. This overrides the settings in the job definition. The
* supported resources include GPU
, MEMORY
, and VCPU
.
*
*
* @param resourceRequirements
* The type and amount of resources to assign to a container. This overrides the settings in the job
* definition. The supported resources include GPU
, MEMORY
, and VCPU
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerOverrides withResourceRequirements(java.util.Collection resourceRequirements) {
setResourceRequirements(resourceRequirements);
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 (getVcpus() != null)
sb.append("Vcpus: ").append(getVcpus()).append(",");
if (getMemory() != null)
sb.append("Memory: ").append(getMemory()).append(",");
if (getCommand() != null)
sb.append("Command: ").append(getCommand()).append(",");
if (getInstanceType() != null)
sb.append("InstanceType: ").append(getInstanceType()).append(",");
if (getEnvironment() != null)
sb.append("Environment: ").append(getEnvironment()).append(",");
if (getResourceRequirements() != null)
sb.append("ResourceRequirements: ").append(getResourceRequirements());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ContainerOverrides == false)
return false;
ContainerOverrides other = (ContainerOverrides) obj;
if (other.getVcpus() == null ^ this.getVcpus() == null)
return false;
if (other.getVcpus() != null && other.getVcpus().equals(this.getVcpus()) == false)
return false;
if (other.getMemory() == null ^ this.getMemory() == null)
return false;
if (other.getMemory() != null && other.getMemory().equals(this.getMemory()) == 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.getInstanceType() == null ^ this.getInstanceType() == null)
return false;
if (other.getInstanceType() != null && other.getInstanceType().equals(this.getInstanceType()) == false)
return false;
if (other.getEnvironment() == null ^ this.getEnvironment() == null)
return false;
if (other.getEnvironment() != null && other.getEnvironment().equals(this.getEnvironment()) == false)
return false;
if (other.getResourceRequirements() == null ^ this.getResourceRequirements() == null)
return false;
if (other.getResourceRequirements() != null && other.getResourceRequirements().equals(this.getResourceRequirements()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getVcpus() == null) ? 0 : getVcpus().hashCode());
hashCode = prime * hashCode + ((getMemory() == null) ? 0 : getMemory().hashCode());
hashCode = prime * hashCode + ((getCommand() == null) ? 0 : getCommand().hashCode());
hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode());
hashCode = prime * hashCode + ((getEnvironment() == null) ? 0 : getEnvironment().hashCode());
hashCode = prime * hashCode + ((getResourceRequirements() == null) ? 0 : getResourceRequirements().hashCode());
return hashCode;
}
@Override
public ContainerOverrides clone() {
try {
return (ContainerOverrides) 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.ContainerOverridesMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}