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

software.amazon.awssdk.services.eks.model.EksAnywhereSubscriptionTerm 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.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 representing the term duration and term unit type of your subscription. This determines the term length of * your subscription. Valid values are MONTHS for term unit and 12 or 36 for term duration, indicating a 12 month or 36 * month subscription. *

*/ @Generated("software.amazon.awssdk:codegen") public final class EksAnywhereSubscriptionTerm implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DURATION_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("duration").getter(getter(EksAnywhereSubscriptionTerm::duration)).setter(setter(Builder::duration)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("duration").build()).build(); private static final SdkField UNIT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("unit") .getter(getter(EksAnywhereSubscriptionTerm::unitAsString)).setter(setter(Builder::unit)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("unit").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DURATION_FIELD, UNIT_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final Integer duration; private final String unit; private EksAnywhereSubscriptionTerm(BuilderImpl builder) { this.duration = builder.duration; this.unit = builder.unit; } /** *

* The duration of the subscription term. Valid values are 12 and 36, indicating a 12 month or 36 month * subscription. *

* * @return The duration of the subscription term. Valid values are 12 and 36, indicating a 12 month or 36 month * subscription. */ public final Integer duration() { return duration; } /** *

* The term unit of the subscription. Valid value is MONTHS. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #unit} will return * {@link EksAnywhereSubscriptionTermUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is * available from {@link #unitAsString}. *

* * @return The term unit of the subscription. Valid value is MONTHS. * @see EksAnywhereSubscriptionTermUnit */ public final EksAnywhereSubscriptionTermUnit unit() { return EksAnywhereSubscriptionTermUnit.fromValue(unit); } /** *

* The term unit of the subscription. Valid value is MONTHS. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #unit} will return * {@link EksAnywhereSubscriptionTermUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is * available from {@link #unitAsString}. *

* * @return The term unit of the subscription. Valid value is MONTHS. * @see EksAnywhereSubscriptionTermUnit */ public final String unitAsString() { return unit; } @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(duration()); hashCode = 31 * hashCode + Objects.hashCode(unitAsString()); 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 EksAnywhereSubscriptionTerm)) { return false; } EksAnywhereSubscriptionTerm other = (EksAnywhereSubscriptionTerm) obj; return Objects.equals(duration(), other.duration()) && Objects.equals(unitAsString(), other.unitAsString()); } /** * 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("EksAnywhereSubscriptionTerm").add("Duration", duration()).add("Unit", unitAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "duration": return Optional.ofNullable(clazz.cast(duration())); case "unit": return Optional.ofNullable(clazz.cast(unitAsString())); 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("duration", DURATION_FIELD); map.put("unit", UNIT_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((EksAnywhereSubscriptionTerm) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The duration of the subscription term. Valid values are 12 and 36, indicating a 12 month or 36 month * subscription. *

* * @param duration * The duration of the subscription term. Valid values are 12 and 36, indicating a 12 month or 36 month * subscription. * @return Returns a reference to this object so that method calls can be chained together. */ Builder duration(Integer duration); /** *

* The term unit of the subscription. Valid value is MONTHS. *

* * @param unit * The term unit of the subscription. Valid value is MONTHS. * @see EksAnywhereSubscriptionTermUnit * @return Returns a reference to this object so that method calls can be chained together. * @see EksAnywhereSubscriptionTermUnit */ Builder unit(String unit); /** *

* The term unit of the subscription. Valid value is MONTHS. *

* * @param unit * The term unit of the subscription. Valid value is MONTHS. * @see EksAnywhereSubscriptionTermUnit * @return Returns a reference to this object so that method calls can be chained together. * @see EksAnywhereSubscriptionTermUnit */ Builder unit(EksAnywhereSubscriptionTermUnit unit); } static final class BuilderImpl implements Builder { private Integer duration; private String unit; private BuilderImpl() { } private BuilderImpl(EksAnywhereSubscriptionTerm model) { duration(model.duration); unit(model.unit); } public final Integer getDuration() { return duration; } public final void setDuration(Integer duration) { this.duration = duration; } @Override public final Builder duration(Integer duration) { this.duration = duration; return this; } public final String getUnit() { return unit; } public final void setUnit(String unit) { this.unit = unit; } @Override public final Builder unit(String unit) { this.unit = unit; return this; } @Override public final Builder unit(EksAnywhereSubscriptionTermUnit unit) { this.unit(unit == null ? null : unit.toString()); return this; } @Override public EksAnywhereSubscriptionTerm build() { return new EksAnywhereSubscriptionTerm(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy