
software.amazon.awssdk.services.eks.model.UpdateNodegroupVersionRequest 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.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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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.DefaultValueTrait;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateNodegroupVersionRequest extends EksRequest implements
ToCopyableBuilder {
private static final SdkField CLUSTER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("clusterName").getter(getter(UpdateNodegroupVersionRequest::clusterName))
.setter(setter(Builder::clusterName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("name").build()).build();
private static final SdkField NODEGROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("nodegroupName").getter(getter(UpdateNodegroupVersionRequest::nodegroupName))
.setter(setter(Builder::nodegroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("nodegroupName").build()).build();
private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("version")
.getter(getter(UpdateNodegroupVersionRequest::version)).setter(setter(Builder::version))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("version").build()).build();
private static final SdkField RELEASE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("releaseVersion").getter(getter(UpdateNodegroupVersionRequest::releaseVersion))
.setter(setter(Builder::releaseVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("releaseVersion").build()).build();
private static final SdkField LAUNCH_TEMPLATE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("launchTemplate")
.getter(getter(UpdateNodegroupVersionRequest::launchTemplate)).setter(setter(Builder::launchTemplate))
.constructor(LaunchTemplateSpecification::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("launchTemplate").build()).build();
private static final SdkField FORCE_FIELD = SdkField. builder(MarshallingType.BOOLEAN).memberName("force")
.getter(getter(UpdateNodegroupVersionRequest::force)).setter(setter(Builder::force))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("force").build()).build();
private static final SdkField CLIENT_REQUEST_TOKEN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("clientRequestToken")
.getter(getter(UpdateNodegroupVersionRequest::clientRequestToken))
.setter(setter(Builder::clientRequestToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientRequestToken").build(),
DefaultValueTrait.idempotencyToken()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLUSTER_NAME_FIELD,
NODEGROUP_NAME_FIELD, VERSION_FIELD, RELEASE_VERSION_FIELD, LAUNCH_TEMPLATE_FIELD, FORCE_FIELD,
CLIENT_REQUEST_TOKEN_FIELD));
private final String clusterName;
private final String nodegroupName;
private final String version;
private final String releaseVersion;
private final LaunchTemplateSpecification launchTemplate;
private final Boolean force;
private final String clientRequestToken;
private UpdateNodegroupVersionRequest(BuilderImpl builder) {
super(builder);
this.clusterName = builder.clusterName;
this.nodegroupName = builder.nodegroupName;
this.version = builder.version;
this.releaseVersion = builder.releaseVersion;
this.launchTemplate = builder.launchTemplate;
this.force = builder.force;
this.clientRequestToken = builder.clientRequestToken;
}
/**
*
* The name of the Amazon EKS cluster that is associated with the managed node group to update.
*
*
* @return The name of the Amazon EKS cluster that is associated with the managed node group to update.
*/
public final String clusterName() {
return clusterName;
}
/**
*
* The name of the managed node group to update.
*
*
* @return The name of the managed node group to update.
*/
public final String nodegroupName() {
return nodegroupName;
}
/**
*
* The Kubernetes version to update to. If no version is specified, then the Kubernetes version of the node group
* does not change. You can specify the Kubernetes version of the cluster to update the node group to the latest AMI
* version of the cluster's Kubernetes version. If you specify launchTemplate
, and your launch template
* uses a custom AMI, then don't specify version
, or the node group update will fail. For more
* information about using launch templates with Amazon EKS, see Launch template support in the
* Amazon EKS User Guide.
*
*
* @return The Kubernetes version to update to. If no version is specified, then the Kubernetes version of the node
* group does not change. You can specify the Kubernetes version of the cluster to update the node group to
* the latest AMI version of the cluster's Kubernetes version. If you specify launchTemplate
,
* and your launch template uses a custom AMI, then don't specify version
, or the node group
* update will fail. For more information about using launch templates with Amazon EKS, see Launch template support
* in the Amazon EKS User Guide.
*/
public final String version() {
return version;
}
/**
*
* The AMI version of the Amazon EKS optimized AMI to use for the update. By default, the latest available AMI
* version for the node group's Kubernetes version is used. For more information, see Amazon EKS optimized Amazon
* Linux 2 AMI versions in the Amazon EKS User Guide. If you specify launchTemplate
, and
* your launch template uses a custom AMI, then don't specify releaseVersion
, or the node group update
* will fail. For more information about using launch templates with Amazon EKS, see Launch template support in the
* Amazon EKS User Guide.
*
*
* @return The AMI version of the Amazon EKS optimized AMI to use for the update. By default, the latest available
* AMI version for the node group's Kubernetes version is used. For more information, see Amazon EKS optimized
* Amazon Linux 2 AMI versions in the Amazon EKS User Guide. If you specify
* launchTemplate
, and your launch template uses a custom AMI, then don't specify
* releaseVersion
, or the node group update will fail. For more information about using launch
* templates with Amazon EKS, see Launch template support
* in the Amazon EKS User Guide.
*/
public final String releaseVersion() {
return releaseVersion;
}
/**
*
* An object representing a node group's launch template specification. You can only update a node group using a
* launch template if the node group was originally deployed with a launch template.
*
*
* @return An object representing a node group's launch template specification. You can only update a node group
* using a launch template if the node group was originally deployed with a launch template.
*/
public final LaunchTemplateSpecification launchTemplate() {
return launchTemplate;
}
/**
*
* Force the update if the existing node group's pods are unable to be drained due to a pod disruption budget issue.
* If an update fails because pods could not be drained, you can force the update after it fails to terminate the
* old node whether or not any pods are running on the node.
*
*
* @return Force the update if the existing node group's pods are unable to be drained due to a pod disruption
* budget issue. If an update fails because pods could not be drained, you can force the update after it
* fails to terminate the old node whether or not any pods are running on the node.
*/
public final Boolean force() {
return force;
}
/**
*
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
*
*
* @return Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
*/
public final String clientRequestToken() {
return clientRequestToken;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(clusterName());
hashCode = 31 * hashCode + Objects.hashCode(nodegroupName());
hashCode = 31 * hashCode + Objects.hashCode(version());
hashCode = 31 * hashCode + Objects.hashCode(releaseVersion());
hashCode = 31 * hashCode + Objects.hashCode(launchTemplate());
hashCode = 31 * hashCode + Objects.hashCode(force());
hashCode = 31 * hashCode + Objects.hashCode(clientRequestToken());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateNodegroupVersionRequest)) {
return false;
}
UpdateNodegroupVersionRequest other = (UpdateNodegroupVersionRequest) obj;
return Objects.equals(clusterName(), other.clusterName()) && Objects.equals(nodegroupName(), other.nodegroupName())
&& Objects.equals(version(), other.version()) && Objects.equals(releaseVersion(), other.releaseVersion())
&& Objects.equals(launchTemplate(), other.launchTemplate()) && Objects.equals(force(), other.force())
&& Objects.equals(clientRequestToken(), other.clientRequestToken());
}
/**
* 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("UpdateNodegroupVersionRequest").add("ClusterName", clusterName())
.add("NodegroupName", nodegroupName()).add("Version", version()).add("ReleaseVersion", releaseVersion())
.add("LaunchTemplate", launchTemplate()).add("Force", force()).add("ClientRequestToken", clientRequestToken())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "clusterName":
return Optional.ofNullable(clazz.cast(clusterName()));
case "nodegroupName":
return Optional.ofNullable(clazz.cast(nodegroupName()));
case "version":
return Optional.ofNullable(clazz.cast(version()));
case "releaseVersion":
return Optional.ofNullable(clazz.cast(releaseVersion()));
case "launchTemplate":
return Optional.ofNullable(clazz.cast(launchTemplate()));
case "force":
return Optional.ofNullable(clazz.cast(force()));
case "clientRequestToken":
return Optional.ofNullable(clazz.cast(clientRequestToken()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function