All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.ecs.model.ContainerOverride Maven / Gradle / Ivy

/*
 * Copyright 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 software.amazon.awssdk.services.ecs.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The overrides that are sent to a container. An empty container override can be passed in. An example of an empty * container override is {"containerOverrides": [ ] }. If a non-empty container override is specified, the * name parameter must be included. *

*

* You can use Secrets Manager or Amazon Web Services Systems Manager Parameter Store to store the sensitive data. For * more information, see Retrieve secrets through * environment variables in the Amazon ECS Developer Guide. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ContainerOverride implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name") .getter(getter(ContainerOverride::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build(); private static final SdkField> COMMAND_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("command") .getter(getter(ContainerOverride::command)) .setter(setter(Builder::command)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("command").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> ENVIRONMENT_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("environment") .getter(getter(ContainerOverride::environment)) .setter(setter(Builder::environment)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("environment").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(KeyValuePair::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> ENVIRONMENT_FILES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("environmentFiles") .getter(getter(ContainerOverride::environmentFiles)) .setter(setter(Builder::environmentFiles)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("environmentFiles").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(EnvironmentFile::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField CPU_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("cpu") .getter(getter(ContainerOverride::cpu)).setter(setter(Builder::cpu)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("cpu").build()).build(); private static final SdkField MEMORY_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("memory").getter(getter(ContainerOverride::memory)).setter(setter(Builder::memory)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("memory").build()).build(); private static final SdkField MEMORY_RESERVATION_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("memoryReservation").getter(getter(ContainerOverride::memoryReservation)) .setter(setter(Builder::memoryReservation)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("memoryReservation").build()).build(); private static final SdkField> RESOURCE_REQUIREMENTS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("resourceRequirements") .getter(getter(ContainerOverride::resourceRequirements)) .setter(setter(Builder::resourceRequirements)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceRequirements").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ResourceRequirement::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, COMMAND_FIELD, ENVIRONMENT_FIELD, ENVIRONMENT_FILES_FIELD, CPU_FIELD, MEMORY_FIELD, MEMORY_RESERVATION_FIELD, RESOURCE_REQUIREMENTS_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String name; private final List command; private final List environment; private final List environmentFiles; private final Integer cpu; private final Integer memory; private final Integer memoryReservation; private final List resourceRequirements; private ContainerOverride(BuilderImpl builder) { this.name = builder.name; this.command = builder.command; this.environment = builder.environment; this.environmentFiles = builder.environmentFiles; this.cpu = builder.cpu; this.memory = builder.memory; this.memoryReservation = builder.memoryReservation; this.resourceRequirements = builder.resourceRequirements; } /** *

* The name of the container that receives the override. This parameter is required if any override is specified. *

* * @return The name of the container that receives the override. This parameter is required if any override is * specified. */ public final String name() { return name; } /** * For responses, this returns true if the service returned a value for the Command property. This DOES NOT check * that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is * useful because the SDK will never return a null collection or map, but you may need to differentiate between the * service returning nothing (or null) and the service returning an empty collection or map. For requests, this * returns true if a value for the property was specified in the request builder, and false if a value was not * specified. */ public final boolean hasCommand() { return command != null && !(command instanceof SdkAutoConstructList); } /** *

* The command to send to the container that overrides the default command from the Docker image or the task * definition. You must also specify a container name. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasCommand} method. *

* * @return The command to send to the container that overrides the default command from the Docker image or the task * definition. You must also specify a container name. */ public final List command() { return command; } /** * For responses, this returns true if the service returned a value for the Environment property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasEnvironment() { return environment != null && !(environment instanceof SdkAutoConstructList); } /** *

* 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. You must also specify a container name. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasEnvironment} method. *

* * @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. You must also specify a container name. */ public final List environment() { return environment; } /** * For responses, this returns true if the service returned a value for the EnvironmentFiles property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasEnvironmentFiles() { return environmentFiles != null && !(environmentFiles instanceof SdkAutoConstructList); } /** *

* A list of files containing the environment variables to pass to a container, instead of the value from the * container definition. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasEnvironmentFiles} method. *

* * @return A list of files containing the environment variables to pass to a container, instead of the value from * the container definition. */ public final List environmentFiles() { return environmentFiles; } /** *

* The number of cpu units reserved for the container, instead of the default value from the task * definition. You must also specify a container name. *

* * @return The number of cpu units reserved for the container, instead of the default value from the * task definition. You must also specify a container name. */ public final Integer cpu() { return cpu; } /** *

* The hard limit (in MiB) of memory to present to the container, instead of the default value from the task * definition. If your container attempts to exceed the memory specified here, the container is killed. You must * also specify a container name. *

* * @return The hard limit (in MiB) of memory to present to the container, instead of the default value from the task * definition. If your container attempts to exceed the memory specified here, the container is killed. You * must also specify a container name. */ public final Integer memory() { return memory; } /** *

* The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the task * definition. You must also specify a container name. *

* * @return The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the * task definition. You must also specify a container name. */ public final Integer memoryReservation() { return memoryReservation; } /** * For responses, this returns true if the service returned a value for the ResourceRequirements property. This DOES * NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasResourceRequirements() { return resourceRequirements != null && !(resourceRequirements instanceof SdkAutoConstructList); } /** *

* The type and amount of a resource to assign to a container, instead of the default value from the task * definition. The only supported resource is a GPU. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasResourceRequirements} method. *

* * @return The type and amount of a resource to assign to a container, instead of the default value from the task * definition. The only supported resource is a GPU. */ public final List resourceRequirements() { return resourceRequirements; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(hasCommand() ? command() : null); hashCode = 31 * hashCode + Objects.hashCode(hasEnvironment() ? environment() : null); hashCode = 31 * hashCode + Objects.hashCode(hasEnvironmentFiles() ? environmentFiles() : null); hashCode = 31 * hashCode + Objects.hashCode(cpu()); hashCode = 31 * hashCode + Objects.hashCode(memory()); hashCode = 31 * hashCode + Objects.hashCode(memoryReservation()); hashCode = 31 * hashCode + Objects.hashCode(hasResourceRequirements() ? resourceRequirements() : null); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ContainerOverride)) { return false; } ContainerOverride other = (ContainerOverride) obj; return Objects.equals(name(), other.name()) && hasCommand() == other.hasCommand() && Objects.equals(command(), other.command()) && hasEnvironment() == other.hasEnvironment() && Objects.equals(environment(), other.environment()) && hasEnvironmentFiles() == other.hasEnvironmentFiles() && Objects.equals(environmentFiles(), other.environmentFiles()) && Objects.equals(cpu(), other.cpu()) && Objects.equals(memory(), other.memory()) && Objects.equals(memoryReservation(), other.memoryReservation()) && hasResourceRequirements() == other.hasResourceRequirements() && Objects.equals(resourceRequirements(), other.resourceRequirements()); } /** * 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. */ @Override public final String toString() { return ToString.builder("ContainerOverride").add("Name", name()).add("Command", hasCommand() ? command() : null) .add("Environment", hasEnvironment() ? environment() : null) .add("EnvironmentFiles", hasEnvironmentFiles() ? environmentFiles() : null).add("Cpu", cpu()) .add("Memory", memory()).add("MemoryReservation", memoryReservation()) .add("ResourceRequirements", hasResourceRequirements() ? resourceRequirements() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "name": return Optional.ofNullable(clazz.cast(name())); case "command": return Optional.ofNullable(clazz.cast(command())); case "environment": return Optional.ofNullable(clazz.cast(environment())); case "environmentFiles": return Optional.ofNullable(clazz.cast(environmentFiles())); case "cpu": return Optional.ofNullable(clazz.cast(cpu())); case "memory": return Optional.ofNullable(clazz.cast(memory())); case "memoryReservation": return Optional.ofNullable(clazz.cast(memoryReservation())); case "resourceRequirements": return Optional.ofNullable(clazz.cast(resourceRequirements())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("name", NAME_FIELD); map.put("command", COMMAND_FIELD); map.put("environment", ENVIRONMENT_FIELD); map.put("environmentFiles", ENVIRONMENT_FILES_FIELD); map.put("cpu", CPU_FIELD); map.put("memory", MEMORY_FIELD); map.put("memoryReservation", MEMORY_RESERVATION_FIELD); map.put("resourceRequirements", RESOURCE_REQUIREMENTS_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((ContainerOverride) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the container that receives the override. This parameter is required if any override is * specified. *

* * @param name * The name of the container that receives the override. This parameter is required if any override is * specified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The command to send to the container that overrides the default command from the Docker image or the task * definition. You must also specify a container name. *

* * @param command * The command to send to the container that overrides the default command from the Docker image or the * task definition. You must also specify a container name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder command(Collection command); /** *

* The command to send to the container that overrides the default command from the Docker image or the task * definition. You must also specify a container name. *

* * @param command * The command to send to the container that overrides the default command from the Docker image or the * task definition. You must also specify a container name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder command(String... command); /** *

* 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. You must also specify a container name. *

* * @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 task definition. You must also specify a container name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder environment(Collection 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. You must also specify a container name. *

* * @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 task definition. You must also specify a container name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder environment(KeyValuePair... 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. You must also specify a container name. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.ecs.model.KeyValuePair.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.ecs.model.KeyValuePair#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.ecs.model.KeyValuePair.Builder#build()} is called immediately and its * result is passed to {@link #environment(List)}. * * @param environment * a consumer that will call methods on * {@link software.amazon.awssdk.services.ecs.model.KeyValuePair.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #environment(java.util.Collection) */ Builder environment(Consumer... environment); /** *

* A list of files containing the environment variables to pass to a container, instead of the value from the * container definition. *

* * @param environmentFiles * A list of files containing the environment variables to pass to a container, instead of the value from * the container definition. * @return Returns a reference to this object so that method calls can be chained together. */ Builder environmentFiles(Collection environmentFiles); /** *

* A list of files containing the environment variables to pass to a container, instead of the value from the * container definition. *

* * @param environmentFiles * A list of files containing the environment variables to pass to a container, instead of the value from * the container definition. * @return Returns a reference to this object so that method calls can be chained together. */ Builder environmentFiles(EnvironmentFile... environmentFiles); /** *

* A list of files containing the environment variables to pass to a container, instead of the value from the * container definition. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.ecs.model.EnvironmentFile.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.ecs.model.EnvironmentFile#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.ecs.model.EnvironmentFile.Builder#build()} is called immediately and * its result is passed to {@link #environmentFiles(List)}. * * @param environmentFiles * a consumer that will call methods on * {@link software.amazon.awssdk.services.ecs.model.EnvironmentFile.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #environmentFiles(java.util.Collection) */ Builder environmentFiles(Consumer... environmentFiles); /** *

* The number of cpu units reserved for the container, instead of the default value from the task * definition. You must also specify a container name. *

* * @param cpu * The number of cpu units reserved for the container, instead of the default value from the * task definition. You must also specify a container name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cpu(Integer cpu); /** *

* The hard limit (in MiB) of memory to present to the container, instead of the default value from the task * definition. If your container attempts to exceed the memory specified here, the container is killed. You must * also specify a container name. *

* * @param memory * The hard limit (in MiB) of memory to present to the container, instead of the default value from the * task definition. If your container attempts to exceed the memory specified here, the container is * killed. You must also specify a container name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder memory(Integer memory); /** *

* The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the task * definition. You must also specify a container name. *

* * @param memoryReservation * The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the * task definition. You must also specify a container name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder memoryReservation(Integer memoryReservation); /** *

* The type and amount of a resource to assign to a container, instead of the default value from the task * definition. The only supported resource is a GPU. *

* * @param resourceRequirements * The type and amount of a resource to assign to a container, instead of the default value from the task * definition. The only supported resource is a GPU. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceRequirements(Collection resourceRequirements); /** *

* The type and amount of a resource to assign to a container, instead of the default value from the task * definition. The only supported resource is a GPU. *

* * @param resourceRequirements * The type and amount of a resource to assign to a container, instead of the default value from the task * definition. The only supported resource is a GPU. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceRequirements(ResourceRequirement... resourceRequirements); /** *

* The type and amount of a resource to assign to a container, instead of the default value from the task * definition. The only supported resource is a GPU. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.ecs.model.ResourceRequirement.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.ecs.model.ResourceRequirement#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.ecs.model.ResourceRequirement.Builder#build()} is called immediately * and its result is passed to {@link #resourceRequirements(List)}. * * @param resourceRequirements * a consumer that will call methods on * {@link software.amazon.awssdk.services.ecs.model.ResourceRequirement.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #resourceRequirements(java.util.Collection) */ Builder resourceRequirements(Consumer... resourceRequirements); } static final class BuilderImpl implements Builder { private String name; private List command = DefaultSdkAutoConstructList.getInstance(); private List environment = DefaultSdkAutoConstructList.getInstance(); private List environmentFiles = DefaultSdkAutoConstructList.getInstance(); private Integer cpu; private Integer memory; private Integer memoryReservation; private List resourceRequirements = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ContainerOverride model) { name(model.name); command(model.command); environment(model.environment); environmentFiles(model.environmentFiles); cpu(model.cpu); memory(model.memory); memoryReservation(model.memoryReservation); resourceRequirements(model.resourceRequirements); } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final Collection getCommand() { if (command instanceof SdkAutoConstructList) { return null; } return command; } public final void setCommand(Collection command) { this.command = StringListCopier.copy(command); } @Override public final Builder command(Collection command) { this.command = StringListCopier.copy(command); return this; } @Override @SafeVarargs public final Builder command(String... command) { command(Arrays.asList(command)); return this; } public final List getEnvironment() { List result = EnvironmentVariablesCopier.copyToBuilder(this.environment); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setEnvironment(Collection environment) { this.environment = EnvironmentVariablesCopier.copyFromBuilder(environment); } @Override public final Builder environment(Collection environment) { this.environment = EnvironmentVariablesCopier.copy(environment); return this; } @Override @SafeVarargs public final Builder environment(KeyValuePair... environment) { environment(Arrays.asList(environment)); return this; } @Override @SafeVarargs public final Builder environment(Consumer... environment) { environment(Stream.of(environment).map(c -> KeyValuePair.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final List getEnvironmentFiles() { List result = EnvironmentFilesCopier.copyToBuilder(this.environmentFiles); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setEnvironmentFiles(Collection environmentFiles) { this.environmentFiles = EnvironmentFilesCopier.copyFromBuilder(environmentFiles); } @Override public final Builder environmentFiles(Collection environmentFiles) { this.environmentFiles = EnvironmentFilesCopier.copy(environmentFiles); return this; } @Override @SafeVarargs public final Builder environmentFiles(EnvironmentFile... environmentFiles) { environmentFiles(Arrays.asList(environmentFiles)); return this; } @Override @SafeVarargs public final Builder environmentFiles(Consumer... environmentFiles) { environmentFiles(Stream.of(environmentFiles).map(c -> EnvironmentFile.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final Integer getCpu() { return cpu; } public final void setCpu(Integer cpu) { this.cpu = cpu; } @Override public final Builder cpu(Integer cpu) { this.cpu = cpu; return this; } public final Integer getMemory() { return memory; } public final void setMemory(Integer memory) { this.memory = memory; } @Override public final Builder memory(Integer memory) { this.memory = memory; return this; } public final Integer getMemoryReservation() { return memoryReservation; } public final void setMemoryReservation(Integer memoryReservation) { this.memoryReservation = memoryReservation; } @Override public final Builder memoryReservation(Integer memoryReservation) { this.memoryReservation = memoryReservation; return this; } public final List getResourceRequirements() { List result = ResourceRequirementsCopier.copyToBuilder(this.resourceRequirements); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setResourceRequirements(Collection resourceRequirements) { this.resourceRequirements = ResourceRequirementsCopier.copyFromBuilder(resourceRequirements); } @Override public final Builder resourceRequirements(Collection resourceRequirements) { this.resourceRequirements = ResourceRequirementsCopier.copy(resourceRequirements); return this; } @Override @SafeVarargs public final Builder resourceRequirements(ResourceRequirement... resourceRequirements) { resourceRequirements(Arrays.asList(resourceRequirements)); return this; } @Override @SafeVarargs public final Builder resourceRequirements(Consumer... resourceRequirements) { resourceRequirements(Stream.of(resourceRequirements).map(c -> ResourceRequirement.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public ContainerOverride build() { return new ContainerOverride(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy