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

software.amazon.awssdk.services.scheduler.model.CapacityProviderStrategyItem Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Scheduler module holds the client classes that are used for communicating with Scheduler.

The newest version!
/*
 * 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.scheduler.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;

/**
 * 

* The details of a capacity provider strategy. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CapacityProviderStrategyItem implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField BASE_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("base") .getter(getter(CapacityProviderStrategyItem::base)).setter(setter(Builder::base)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("base").build()).build(); private static final SdkField CAPACITY_PROVIDER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("capacityProvider").getter(getter(CapacityProviderStrategyItem::capacityProvider)) .setter(setter(Builder::capacityProvider)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("capacityProvider").build()).build(); private static final SdkField WEIGHT_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("weight").getter(getter(CapacityProviderStrategyItem::weight)).setter(setter(Builder::weight)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("weight").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BASE_FIELD, CAPACITY_PROVIDER_FIELD, WEIGHT_FIELD)); private static final long serialVersionUID = 1L; private final Integer base; private final String capacityProvider; private final Integer weight; private CapacityProviderStrategyItem(BuilderImpl builder) { this.base = builder.base; this.capacityProvider = builder.capacityProvider; this.weight = builder.weight; } /** *

* The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one * capacity provider in a capacity provider strategy can have a base defined. If no value is specified, the default * value of 0 is used. *

* * @return The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only * one capacity provider in a capacity provider strategy can have a base defined. If no value is specified, * the default value of 0 is used. */ public final Integer base() { return base; } /** *

* The short name of the capacity provider. *

* * @return The short name of the capacity provider. */ public final String capacityProvider() { return capacityProvider; } /** *

* The weight value designates the relative percentage of the total number of tasks launched that should use the * specified capacity provider. The weight value is taken into consideration after the base value, if defined, is * satisfied. *

* * @return The weight value designates the relative percentage of the total number of tasks launched that should use * the specified capacity provider. The weight value is taken into consideration after the base value, if * defined, is satisfied. */ public final Integer weight() { return weight; } @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(base()); hashCode = 31 * hashCode + Objects.hashCode(capacityProvider()); hashCode = 31 * hashCode + Objects.hashCode(weight()); 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 CapacityProviderStrategyItem)) { return false; } CapacityProviderStrategyItem other = (CapacityProviderStrategyItem) obj; return Objects.equals(base(), other.base()) && Objects.equals(capacityProvider(), other.capacityProvider()) && Objects.equals(weight(), other.weight()); } /** * 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("CapacityProviderStrategyItem").add("Base", base()).add("CapacityProvider", capacityProvider()) .add("Weight", weight()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "base": return Optional.ofNullable(clazz.cast(base())); case "capacityProvider": return Optional.ofNullable(clazz.cast(capacityProvider())); case "weight": return Optional.ofNullable(clazz.cast(weight())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CapacityProviderStrategyItem) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one * capacity provider in a capacity provider strategy can have a base defined. If no value is specified, the * default value of 0 is used. *

* * @param base * The base value designates how many tasks, at a minimum, to run on the specified capacity provider. * Only one capacity provider in a capacity provider strategy can have a base defined. If no value is * specified, the default value of 0 is used. * @return Returns a reference to this object so that method calls can be chained together. */ Builder base(Integer base); /** *

* The short name of the capacity provider. *

* * @param capacityProvider * The short name of the capacity provider. * @return Returns a reference to this object so that method calls can be chained together. */ Builder capacityProvider(String capacityProvider); /** *

* The weight value designates the relative percentage of the total number of tasks launched that should use the * specified capacity provider. The weight value is taken into consideration after the base value, if defined, * is satisfied. *

* * @param weight * The weight value designates the relative percentage of the total number of tasks launched that should * use the specified capacity provider. The weight value is taken into consideration after the base * value, if defined, is satisfied. * @return Returns a reference to this object so that method calls can be chained together. */ Builder weight(Integer weight); } static final class BuilderImpl implements Builder { private Integer base; private String capacityProvider; private Integer weight; private BuilderImpl() { } private BuilderImpl(CapacityProviderStrategyItem model) { base(model.base); capacityProvider(model.capacityProvider); weight(model.weight); } public final Integer getBase() { return base; } public final void setBase(Integer base) { this.base = base; } @Override public final Builder base(Integer base) { this.base = base; return this; } public final String getCapacityProvider() { return capacityProvider; } public final void setCapacityProvider(String capacityProvider) { this.capacityProvider = capacityProvider; } @Override public final Builder capacityProvider(String capacityProvider) { this.capacityProvider = capacityProvider; return this; } public final Integer getWeight() { return weight; } public final void setWeight(Integer weight) { this.weight = weight; } @Override public final Builder weight(Integer weight) { this.weight = weight; return this; } @Override public CapacityProviderStrategyItem build() { return new CapacityProviderStrategyItem(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy