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

software.amazon.awssdk.services.emr.model.SimpleScalingPolicyConfiguration Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EMR module holds the client classes that are used for communicating with Amazon Elastic MapReduce Service

There is a newer version: 2.29.15
Show 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.emr.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;

/**
 * 

* An automatic scaling configuration, which describes how the policy adds or removes instances, the cooldown period, * and the number of EC2 instances that will be added each time the CloudWatch metric alarm condition is satisfied. *

*/ @Generated("software.amazon.awssdk:codegen") public final class SimpleScalingPolicyConfiguration implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ADJUSTMENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(SimpleScalingPolicyConfiguration::adjustmentTypeAsString)).setter(setter(Builder::adjustmentType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AdjustmentType").build()).build(); private static final SdkField SCALING_ADJUSTMENT_FIELD = SdkField. builder(MarshallingType.INTEGER) .getter(getter(SimpleScalingPolicyConfiguration::scalingAdjustment)).setter(setter(Builder::scalingAdjustment)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScalingAdjustment").build()).build(); private static final SdkField COOL_DOWN_FIELD = SdkField. builder(MarshallingType.INTEGER) .getter(getter(SimpleScalingPolicyConfiguration::coolDown)).setter(setter(Builder::coolDown)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CoolDown").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ADJUSTMENT_TYPE_FIELD, SCALING_ADJUSTMENT_FIELD, COOL_DOWN_FIELD)); private static final long serialVersionUID = 1L; private final String adjustmentType; private final Integer scalingAdjustment; private final Integer coolDown; private SimpleScalingPolicyConfiguration(BuilderImpl builder) { this.adjustmentType = builder.adjustmentType; this.scalingAdjustment = builder.scalingAdjustment; this.coolDown = builder.coolDown; } /** *

* The way in which EC2 instances are added (if ScalingAdjustment is a positive number) or terminated * (if ScalingAdjustment is a negative number) each time the scaling activity is triggered. * CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates that the EC2 instance * count increments or decrements by ScalingAdjustment, which should be expressed as an integer. * PERCENT_CHANGE_IN_CAPACITY indicates the instance count increments or decrements by the percentage * specified by ScalingAdjustment, which should be expressed as an integer. For example, 20 indicates * an increase in 20% increments of cluster capacity. EXACT_CAPACITY indicates the scaling activity * results in an instance group with the number of EC2 instances specified by ScalingAdjustment, which * should be expressed as a positive integer. *

*

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

* * @return The way in which EC2 instances are added (if ScalingAdjustment is a positive number) or * terminated (if ScalingAdjustment is a negative number) each time the scaling activity is * triggered. CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates that * the EC2 instance count increments or decrements by ScalingAdjustment, which should be * expressed as an integer. PERCENT_CHANGE_IN_CAPACITY indicates the instance count increments * or decrements by the percentage specified by ScalingAdjustment, which should be expressed as * an integer. For example, 20 indicates an increase in 20% increments of cluster capacity. * EXACT_CAPACITY indicates the scaling activity results in an instance group with the number * of EC2 instances specified by ScalingAdjustment, which should be expressed as a positive * integer. * @see AdjustmentType */ public AdjustmentType adjustmentType() { return AdjustmentType.fromValue(adjustmentType); } /** *

* The way in which EC2 instances are added (if ScalingAdjustment is a positive number) or terminated * (if ScalingAdjustment is a negative number) each time the scaling activity is triggered. * CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates that the EC2 instance * count increments or decrements by ScalingAdjustment, which should be expressed as an integer. * PERCENT_CHANGE_IN_CAPACITY indicates the instance count increments or decrements by the percentage * specified by ScalingAdjustment, which should be expressed as an integer. For example, 20 indicates * an increase in 20% increments of cluster capacity. EXACT_CAPACITY indicates the scaling activity * results in an instance group with the number of EC2 instances specified by ScalingAdjustment, which * should be expressed as a positive integer. *

*

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

* * @return The way in which EC2 instances are added (if ScalingAdjustment is a positive number) or * terminated (if ScalingAdjustment is a negative number) each time the scaling activity is * triggered. CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates that * the EC2 instance count increments or decrements by ScalingAdjustment, which should be * expressed as an integer. PERCENT_CHANGE_IN_CAPACITY indicates the instance count increments * or decrements by the percentage specified by ScalingAdjustment, which should be expressed as * an integer. For example, 20 indicates an increase in 20% increments of cluster capacity. * EXACT_CAPACITY indicates the scaling activity results in an instance group with the number * of EC2 instances specified by ScalingAdjustment, which should be expressed as a positive * integer. * @see AdjustmentType */ public String adjustmentTypeAsString() { return adjustmentType; } /** *

* The amount by which to scale in or scale out, based on the specified AdjustmentType. A positive * value adds to the instance group's EC2 instance count while a negative number removes instances. If * AdjustmentType is set to EXACT_CAPACITY, the number should only be a positive integer. * If AdjustmentType is set to PERCENT_CHANGE_IN_CAPACITY, the value should express the * percentage as an integer. For example, -20 indicates a decrease in 20% increments of cluster capacity. *

* * @return The amount by which to scale in or scale out, based on the specified AdjustmentType. A * positive value adds to the instance group's EC2 instance count while a negative number removes instances. * If AdjustmentType is set to EXACT_CAPACITY, the number should only be a * positive integer. If AdjustmentType is set to PERCENT_CHANGE_IN_CAPACITY, the * value should express the percentage as an integer. For example, -20 indicates a decrease in 20% * increments of cluster capacity. */ public Integer scalingAdjustment() { return scalingAdjustment; } /** *

* The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling * activities can start. The default value is 0. *

* * @return The amount of time, in seconds, after a scaling activity completes before any further trigger-related * scaling activities can start. The default value is 0. */ public Integer coolDown() { return coolDown; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(adjustmentTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(scalingAdjustment()); hashCode = 31 * hashCode + Objects.hashCode(coolDown()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof SimpleScalingPolicyConfiguration)) { return false; } SimpleScalingPolicyConfiguration other = (SimpleScalingPolicyConfiguration) obj; return Objects.equals(adjustmentTypeAsString(), other.adjustmentTypeAsString()) && Objects.equals(scalingAdjustment(), other.scalingAdjustment()) && Objects.equals(coolDown(), other.coolDown()); } /** * 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 String toString() { return ToString.builder("SimpleScalingPolicyConfiguration").add("AdjustmentType", adjustmentTypeAsString()) .add("ScalingAdjustment", scalingAdjustment()).add("CoolDown", coolDown()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "AdjustmentType": return Optional.ofNullable(clazz.cast(adjustmentTypeAsString())); case "ScalingAdjustment": return Optional.ofNullable(clazz.cast(scalingAdjustment())); case "CoolDown": return Optional.ofNullable(clazz.cast(coolDown())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((SimpleScalingPolicyConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The way in which EC2 instances are added (if ScalingAdjustment is a positive number) or * terminated (if ScalingAdjustment is a negative number) each time the scaling activity is * triggered. CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates that the * EC2 instance count increments or decrements by ScalingAdjustment, which should be expressed as * an integer. PERCENT_CHANGE_IN_CAPACITY indicates the instance count increments or decrements by * the percentage specified by ScalingAdjustment, which should be expressed as an integer. For * example, 20 indicates an increase in 20% increments of cluster capacity. EXACT_CAPACITY * indicates the scaling activity results in an instance group with the number of EC2 instances specified by * ScalingAdjustment, which should be expressed as a positive integer. *

* * @param adjustmentType * The way in which EC2 instances are added (if ScalingAdjustment is a positive number) or * terminated (if ScalingAdjustment is a negative number) each time the scaling activity is * triggered. CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates * that the EC2 instance count increments or decrements by ScalingAdjustment, which should * be expressed as an integer. PERCENT_CHANGE_IN_CAPACITY indicates the instance count * increments or decrements by the percentage specified by ScalingAdjustment, which should * be expressed as an integer. For example, 20 indicates an increase in 20% increments of cluster * capacity. EXACT_CAPACITY indicates the scaling activity results in an instance group with * the number of EC2 instances specified by ScalingAdjustment, which should be expressed as * a positive integer. * @see AdjustmentType * @return Returns a reference to this object so that method calls can be chained together. * @see AdjustmentType */ Builder adjustmentType(String adjustmentType); /** *

* The way in which EC2 instances are added (if ScalingAdjustment is a positive number) or * terminated (if ScalingAdjustment is a negative number) each time the scaling activity is * triggered. CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates that the * EC2 instance count increments or decrements by ScalingAdjustment, which should be expressed as * an integer. PERCENT_CHANGE_IN_CAPACITY indicates the instance count increments or decrements by * the percentage specified by ScalingAdjustment, which should be expressed as an integer. For * example, 20 indicates an increase in 20% increments of cluster capacity. EXACT_CAPACITY * indicates the scaling activity results in an instance group with the number of EC2 instances specified by * ScalingAdjustment, which should be expressed as a positive integer. *

* * @param adjustmentType * The way in which EC2 instances are added (if ScalingAdjustment is a positive number) or * terminated (if ScalingAdjustment is a negative number) each time the scaling activity is * triggered. CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates * that the EC2 instance count increments or decrements by ScalingAdjustment, which should * be expressed as an integer. PERCENT_CHANGE_IN_CAPACITY indicates the instance count * increments or decrements by the percentage specified by ScalingAdjustment, which should * be expressed as an integer. For example, 20 indicates an increase in 20% increments of cluster * capacity. EXACT_CAPACITY indicates the scaling activity results in an instance group with * the number of EC2 instances specified by ScalingAdjustment, which should be expressed as * a positive integer. * @see AdjustmentType * @return Returns a reference to this object so that method calls can be chained together. * @see AdjustmentType */ Builder adjustmentType(AdjustmentType adjustmentType); /** *

* The amount by which to scale in or scale out, based on the specified AdjustmentType. A positive * value adds to the instance group's EC2 instance count while a negative number removes instances. If * AdjustmentType is set to EXACT_CAPACITY, the number should only be a positive * integer. If AdjustmentType is set to PERCENT_CHANGE_IN_CAPACITY, the value should * express the percentage as an integer. For example, -20 indicates a decrease in 20% increments of cluster * capacity. *

* * @param scalingAdjustment * The amount by which to scale in or scale out, based on the specified AdjustmentType. A * positive value adds to the instance group's EC2 instance count while a negative number removes * instances. If AdjustmentType is set to EXACT_CAPACITY, the number should * only be a positive integer. If AdjustmentType is set to * PERCENT_CHANGE_IN_CAPACITY, the value should express the percentage as an integer. For * example, -20 indicates a decrease in 20% increments of cluster capacity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder scalingAdjustment(Integer scalingAdjustment); /** *

* The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling * activities can start. The default value is 0. *

* * @param coolDown * The amount of time, in seconds, after a scaling activity completes before any further trigger-related * scaling activities can start. The default value is 0. * @return Returns a reference to this object so that method calls can be chained together. */ Builder coolDown(Integer coolDown); } static final class BuilderImpl implements Builder { private String adjustmentType; private Integer scalingAdjustment; private Integer coolDown; private BuilderImpl() { } private BuilderImpl(SimpleScalingPolicyConfiguration model) { adjustmentType(model.adjustmentType); scalingAdjustment(model.scalingAdjustment); coolDown(model.coolDown); } public final String getAdjustmentTypeAsString() { return adjustmentType; } @Override public final Builder adjustmentType(String adjustmentType) { this.adjustmentType = adjustmentType; return this; } @Override public final Builder adjustmentType(AdjustmentType adjustmentType) { this.adjustmentType(adjustmentType == null ? null : adjustmentType.toString()); return this; } public final void setAdjustmentType(String adjustmentType) { this.adjustmentType = adjustmentType; } public final Integer getScalingAdjustment() { return scalingAdjustment; } @Override public final Builder scalingAdjustment(Integer scalingAdjustment) { this.scalingAdjustment = scalingAdjustment; return this; } public final void setScalingAdjustment(Integer scalingAdjustment) { this.scalingAdjustment = scalingAdjustment; } public final Integer getCoolDown() { return coolDown; } @Override public final Builder coolDown(Integer coolDown) { this.coolDown = coolDown; return this; } public final void setCoolDown(Integer coolDown) { this.coolDown = coolDown; } @Override public SimpleScalingPolicyConfiguration build() { return new SimpleScalingPolicyConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy