software.amazon.awssdk.services.eks.model.ClusterVersionInformation 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.eks.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* Contains details about a specific EKS cluster version.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ClusterVersionInformation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CLUSTER_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("clusterVersion").getter(getter(ClusterVersionInformation::clusterVersion))
.setter(setter(Builder::clusterVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clusterVersion").build()).build();
private static final SdkField CLUSTER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("clusterType").getter(getter(ClusterVersionInformation::clusterType))
.setter(setter(Builder::clusterType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clusterType").build()).build();
private static final SdkField DEFAULT_PLATFORM_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("defaultPlatformVersion").getter(getter(ClusterVersionInformation::defaultPlatformVersion))
.setter(setter(Builder::defaultPlatformVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("defaultPlatformVersion").build())
.build();
private static final SdkField DEFAULT_VERSION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("defaultVersion").getter(getter(ClusterVersionInformation::defaultVersion))
.setter(setter(Builder::defaultVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("defaultVersion").build()).build();
private static final SdkField RELEASE_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("releaseDate").getter(getter(ClusterVersionInformation::releaseDate))
.setter(setter(Builder::releaseDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("releaseDate").build()).build();
private static final SdkField END_OF_STANDARD_SUPPORT_DATE_FIELD = SdkField
. builder(MarshallingType.INSTANT).memberName("endOfStandardSupportDate")
.getter(getter(ClusterVersionInformation::endOfStandardSupportDate))
.setter(setter(Builder::endOfStandardSupportDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endOfStandardSupportDate").build())
.build();
private static final SdkField END_OF_EXTENDED_SUPPORT_DATE_FIELD = SdkField
. builder(MarshallingType.INSTANT).memberName("endOfExtendedSupportDate")
.getter(getter(ClusterVersionInformation::endOfExtendedSupportDate))
.setter(setter(Builder::endOfExtendedSupportDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endOfExtendedSupportDate").build())
.build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(ClusterVersionInformation::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField KUBERNETES_PATCH_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("kubernetesPatchVersion").getter(getter(ClusterVersionInformation::kubernetesPatchVersion))
.setter(setter(Builder::kubernetesPatchVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kubernetesPatchVersion").build())
.build();
private static final List> SDK_FIELDS = Collections
.unmodifiableList(Arrays.asList(CLUSTER_VERSION_FIELD, CLUSTER_TYPE_FIELD, DEFAULT_PLATFORM_VERSION_FIELD,
DEFAULT_VERSION_FIELD, RELEASE_DATE_FIELD, END_OF_STANDARD_SUPPORT_DATE_FIELD,
END_OF_EXTENDED_SUPPORT_DATE_FIELD, STATUS_FIELD, KUBERNETES_PATCH_VERSION_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String clusterVersion;
private final String clusterType;
private final String defaultPlatformVersion;
private final Boolean defaultVersion;
private final Instant releaseDate;
private final Instant endOfStandardSupportDate;
private final Instant endOfExtendedSupportDate;
private final String status;
private final String kubernetesPatchVersion;
private ClusterVersionInformation(BuilderImpl builder) {
this.clusterVersion = builder.clusterVersion;
this.clusterType = builder.clusterType;
this.defaultPlatformVersion = builder.defaultPlatformVersion;
this.defaultVersion = builder.defaultVersion;
this.releaseDate = builder.releaseDate;
this.endOfStandardSupportDate = builder.endOfStandardSupportDate;
this.endOfExtendedSupportDate = builder.endOfExtendedSupportDate;
this.status = builder.status;
this.kubernetesPatchVersion = builder.kubernetesPatchVersion;
}
/**
*
* The Kubernetes version for the cluster.
*
*
* @return The Kubernetes version for the cluster.
*/
public final String clusterVersion() {
return clusterVersion;
}
/**
*
* The type of cluster this version is for.
*
*
* @return The type of cluster this version is for.
*/
public final String clusterType() {
return clusterType;
}
/**
*
* Default platform version for this Kubernetes version.
*
*
* @return Default platform version for this Kubernetes version.
*/
public final String defaultPlatformVersion() {
return defaultPlatformVersion;
}
/**
*
* Indicates if this is a default version.
*
*
* @return Indicates if this is a default version.
*/
public final Boolean defaultVersion() {
return defaultVersion;
}
/**
*
* The release date of this cluster version.
*
*
* @return The release date of this cluster version.
*/
public final Instant releaseDate() {
return releaseDate;
}
/**
*
* Date when standard support ends for this version.
*
*
* @return Date when standard support ends for this version.
*/
public final Instant endOfStandardSupportDate() {
return endOfStandardSupportDate;
}
/**
*
* Date when extended support ends for this version.
*
*
* @return Date when extended support ends for this version.
*/
public final Instant endOfExtendedSupportDate() {
return endOfExtendedSupportDate;
}
/**
*
* Current status of this cluster version.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ClusterVersionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return Current status of this cluster version.
* @see ClusterVersionStatus
*/
public final ClusterVersionStatus status() {
return ClusterVersionStatus.fromValue(status);
}
/**
*
* Current status of this cluster version.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ClusterVersionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return Current status of this cluster version.
* @see ClusterVersionStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The patch version of Kubernetes for this cluster version.
*
*
* @return The patch version of Kubernetes for this cluster version.
*/
public final String kubernetesPatchVersion() {
return kubernetesPatchVersion;
}
@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(clusterVersion());
hashCode = 31 * hashCode + Objects.hashCode(clusterType());
hashCode = 31 * hashCode + Objects.hashCode(defaultPlatformVersion());
hashCode = 31 * hashCode + Objects.hashCode(defaultVersion());
hashCode = 31 * hashCode + Objects.hashCode(releaseDate());
hashCode = 31 * hashCode + Objects.hashCode(endOfStandardSupportDate());
hashCode = 31 * hashCode + Objects.hashCode(endOfExtendedSupportDate());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(kubernetesPatchVersion());
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 ClusterVersionInformation)) {
return false;
}
ClusterVersionInformation other = (ClusterVersionInformation) obj;
return Objects.equals(clusterVersion(), other.clusterVersion()) && Objects.equals(clusterType(), other.clusterType())
&& Objects.equals(defaultPlatformVersion(), other.defaultPlatformVersion())
&& Objects.equals(defaultVersion(), other.defaultVersion()) && Objects.equals(releaseDate(), other.releaseDate())
&& Objects.equals(endOfStandardSupportDate(), other.endOfStandardSupportDate())
&& Objects.equals(endOfExtendedSupportDate(), other.endOfExtendedSupportDate())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(kubernetesPatchVersion(), other.kubernetesPatchVersion());
}
/**
* 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("ClusterVersionInformation").add("ClusterVersion", clusterVersion())
.add("ClusterType", clusterType()).add("DefaultPlatformVersion", defaultPlatformVersion())
.add("DefaultVersion", defaultVersion()).add("ReleaseDate", releaseDate())
.add("EndOfStandardSupportDate", endOfStandardSupportDate())
.add("EndOfExtendedSupportDate", endOfExtendedSupportDate()).add("Status", statusAsString())
.add("KubernetesPatchVersion", kubernetesPatchVersion()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "clusterVersion":
return Optional.ofNullable(clazz.cast(clusterVersion()));
case "clusterType":
return Optional.ofNullable(clazz.cast(clusterType()));
case "defaultPlatformVersion":
return Optional.ofNullable(clazz.cast(defaultPlatformVersion()));
case "defaultVersion":
return Optional.ofNullable(clazz.cast(defaultVersion()));
case "releaseDate":
return Optional.ofNullable(clazz.cast(releaseDate()));
case "endOfStandardSupportDate":
return Optional.ofNullable(clazz.cast(endOfStandardSupportDate()));
case "endOfExtendedSupportDate":
return Optional.ofNullable(clazz.cast(endOfExtendedSupportDate()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "kubernetesPatchVersion":
return Optional.ofNullable(clazz.cast(kubernetesPatchVersion()));
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("clusterVersion", CLUSTER_VERSION_FIELD);
map.put("clusterType", CLUSTER_TYPE_FIELD);
map.put("defaultPlatformVersion", DEFAULT_PLATFORM_VERSION_FIELD);
map.put("defaultVersion", DEFAULT_VERSION_FIELD);
map.put("releaseDate", RELEASE_DATE_FIELD);
map.put("endOfStandardSupportDate", END_OF_STANDARD_SUPPORT_DATE_FIELD);
map.put("endOfExtendedSupportDate", END_OF_EXTENDED_SUPPORT_DATE_FIELD);
map.put("status", STATUS_FIELD);
map.put("kubernetesPatchVersion", KUBERNETES_PATCH_VERSION_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function