software.amazon.awssdk.services.batch.model.RuntimePlatform Maven / Gradle / Ivy
Show all versions of batch Show documentation
/*
* 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.batch.model;
import java.io.Serializable;
import java.util.Arrays;
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.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* An object that represents the compute environment architecture for Batch jobs on Fargate.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RuntimePlatform implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField OPERATING_SYSTEM_FAMILY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("operatingSystemFamily").getter(getter(RuntimePlatform::operatingSystemFamily))
.setter(setter(Builder::operatingSystemFamily))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("operatingSystemFamily").build())
.build();
private static final SdkField CPU_ARCHITECTURE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("cpuArchitecture").getter(getter(RuntimePlatform::cpuArchitecture))
.setter(setter(Builder::cpuArchitecture))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("cpuArchitecture").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(OPERATING_SYSTEM_FAMILY_FIELD,
CPU_ARCHITECTURE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("operatingSystemFamily", OPERATING_SYSTEM_FAMILY_FIELD);
put("cpuArchitecture", CPU_ARCHITECTURE_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String operatingSystemFamily;
private final String cpuArchitecture;
private RuntimePlatform(BuilderImpl builder) {
this.operatingSystemFamily = builder.operatingSystemFamily;
this.cpuArchitecture = builder.cpuArchitecture;
}
/**
*
* The operating system for the compute environment. Valid values are: LINUX
(default),
* WINDOWS_SERVER_2019_CORE
, WINDOWS_SERVER_2019_FULL
,
* WINDOWS_SERVER_2022_CORE
, and WINDOWS_SERVER_2022_FULL
.
*
*
*
* The following parameters can’t be set for Windows containers: linuxParameters
,
* privileged
, user
, ulimits
, readonlyRootFilesystem
, and
* efsVolumeConfiguration
.
*
*
*
* The Batch Scheduler checks the compute environments that are attached to the job queue before registering a task
* definition with Fargate. In this scenario, the job queue is where the job is submitted. If the job requires a
* Windows container and the first compute environment is LINUX
, the compute environment is skipped and
* the next compute environment is checked until a Windows-based compute environment is found.
*
*
*
* Fargate Spot is not supported for ARM64
and Windows-based containers on Fargate. A job queue will be
* blocked if a Fargate ARM64
or Windows job is submitted to a job queue with only Fargate Spot compute
* environments. However, you can attach both FARGATE
and FARGATE_SPOT
compute
* environments to the same job queue.
*
*
*
* @return The operating system for the compute environment. Valid values are: LINUX
(default),
* WINDOWS_SERVER_2019_CORE
, WINDOWS_SERVER_2019_FULL
,
* WINDOWS_SERVER_2022_CORE
, and WINDOWS_SERVER_2022_FULL
.
*
* The following parameters can’t be set for Windows containers: linuxParameters
,
* privileged
, user
, ulimits
, readonlyRootFilesystem
,
* and efsVolumeConfiguration
.
*
*
*
* The Batch Scheduler checks the compute environments that are attached to the job queue before registering
* a task definition with Fargate. In this scenario, the job queue is where the job is submitted. If the job
* requires a Windows container and the first compute environment is LINUX
, the compute
* environment is skipped and the next compute environment is checked until a Windows-based compute
* environment is found.
*
*
*
* Fargate Spot is not supported for ARM64
and Windows-based containers on Fargate. A job queue
* will be blocked if a Fargate ARM64
or Windows job is submitted to a job queue with only
* Fargate Spot compute environments. However, you can attach both FARGATE
and
* FARGATE_SPOT
compute environments to the same job queue.
*
*/
public final String operatingSystemFamily() {
return operatingSystemFamily;
}
/**
*
* The vCPU architecture. The default value is X86_64
. Valid values are X86_64
and
* ARM64
.
*
*
*
* This parameter must be set to X86_64
for Windows containers.
*
*
*
* Fargate Spot is not supported for ARM64
and Windows-based containers on Fargate. A job queue will be
* blocked if a Fargate ARM64
or Windows job is submitted to a job queue with only Fargate Spot compute
* environments. However, you can attach both FARGATE
and FARGATE_SPOT
compute
* environments to the same job queue.
*
*
*
* @return The vCPU architecture. The default value is X86_64
. Valid values are X86_64
and
* ARM64
.
*
* This parameter must be set to X86_64
for Windows containers.
*
*
*
* Fargate Spot is not supported for ARM64
and Windows-based containers on Fargate. A job queue
* will be blocked if a Fargate ARM64
or Windows job is submitted to a job queue with only
* Fargate Spot compute environments. However, you can attach both FARGATE
and
* FARGATE_SPOT
compute environments to the same job queue.
*
*/
public final String cpuArchitecture() {
return cpuArchitecture;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(operatingSystemFamily());
hashCode = 31 * hashCode + Objects.hashCode(cpuArchitecture());
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 RuntimePlatform)) {
return false;
}
RuntimePlatform other = (RuntimePlatform) obj;
return Objects.equals(operatingSystemFamily(), other.operatingSystemFamily())
&& Objects.equals(cpuArchitecture(), other.cpuArchitecture());
}
/**
* 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("RuntimePlatform").add("OperatingSystemFamily", operatingSystemFamily())
.add("CpuArchitecture", cpuArchitecture()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "operatingSystemFamily":
return Optional.ofNullable(clazz.cast(operatingSystemFamily()));
case "cpuArchitecture":
return Optional.ofNullable(clazz.cast(cpuArchitecture()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function