software.amazon.awssdk.services.batch.model.EksConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of batch Show documentation
Show all versions of batch Show documentation
The AWS Java SDK for AWS Batch module holds the client classes that are used for communicating with AWS
Batch.
/*
* 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.List;
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;
/**
*
* Configuration for the Amazon EKS cluster that supports the Batch compute environment. The cluster must exist before
* the compute environment can be created.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EksConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField EKS_CLUSTER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("eksClusterArn").getter(getter(EksConfiguration::eksClusterArn)).setter(setter(Builder::eksClusterArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("eksClusterArn").build()).build();
private static final SdkField KUBERNETES_NAMESPACE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("kubernetesNamespace").getter(getter(EksConfiguration::kubernetesNamespace))
.setter(setter(Builder::kubernetesNamespace))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kubernetesNamespace").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(EKS_CLUSTER_ARN_FIELD,
KUBERNETES_NAMESPACE_FIELD));
private static final long serialVersionUID = 1L;
private final String eksClusterArn;
private final String kubernetesNamespace;
private EksConfiguration(BuilderImpl builder) {
this.eksClusterArn = builder.eksClusterArn;
this.kubernetesNamespace = builder.kubernetesNamespace;
}
/**
*
* The Amazon Resource Name (ARN) of the Amazon EKS cluster. An example is
* arn:aws:eks:us-east-1:123456789012:cluster/ClusterForBatch
.
*
*
* @return The Amazon Resource Name (ARN) of the Amazon EKS cluster. An example is
* arn:aws:eks:us-east-1:123456789012:cluster/ClusterForBatch
.
*/
public final String eksClusterArn() {
return eksClusterArn;
}
/**
*
* The namespace of the Amazon EKS cluster. Batch manages pods in this namespace. The value can't left empty or
* null. It must be fewer than 64 characters long, can't be set to default
, can't start with "
* kube-
," and must match this regular expression: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
. For
* more information, see Namespaces in the
* Kubernetes documentation.
*
*
* @return The namespace of the Amazon EKS cluster. Batch manages pods in this namespace. The value can't left empty
* or null. It must be fewer than 64 characters long, can't be set to default
, can't start with
* "kube-
," and must match this regular expression:
* ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
. For more information, see Namespaces in
* the Kubernetes documentation.
*/
public final String kubernetesNamespace() {
return kubernetesNamespace;
}
@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(eksClusterArn());
hashCode = 31 * hashCode + Objects.hashCode(kubernetesNamespace());
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 EksConfiguration)) {
return false;
}
EksConfiguration other = (EksConfiguration) obj;
return Objects.equals(eksClusterArn(), other.eksClusterArn())
&& Objects.equals(kubernetesNamespace(), other.kubernetesNamespace());
}
/**
* 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("EksConfiguration").add("EksClusterArn", eksClusterArn())
.add("KubernetesNamespace", kubernetesNamespace()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "eksClusterArn":
return Optional.ofNullable(clazz.cast(eksClusterArn()));
case "kubernetesNamespace":
return Optional.ofNullable(clazz.cast(kubernetesNamespace()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function