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

software.amazon.awssdk.services.autoscaling.model.PredictiveScalingMetricSpecification Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Auto Scaling module holds the client classes that are used for communicating with Auto Scaling 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.autoscaling.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.Consumer;
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;

/**
 * 

* This structure specifies the metrics and target utilization settings for a predictive scaling policy. *

*

* You must specify either a metric pair, or a load metric and a scaling metric individually. Specifying a metric pair * instead of individual metrics provides a simpler way to configure metrics for a scaling policy. You choose the metric * pair, and the policy automatically knows the correct sum and average statistics to use for the load metric and the * scaling metric. *

*

* Example *

*
    *
  • *

    * You create a predictive scaling policy and specify ALBRequestCount as the value for the metric pair and * 1000.0 as the target value. For this type of metric, you must provide the metric dimension for the * corresponding target group, so you also provide a resource label for the Application Load Balancer target group that * is attached to your Auto Scaling group. *

    *
  • *
  • *

    * The number of requests the target group receives per minute provides the load metric, and the request count averaged * between the members of the target group provides the scaling metric. In CloudWatch, this refers to the * RequestCount and RequestCountPerTarget metrics, respectively. *

    *
  • *
  • *

    * For optimal use of predictive scaling, you adhere to the best practice of using a dynamic scaling policy to * automatically scale between the minimum capacity and maximum capacity in response to real-time changes in resource * utilization. *

    *
  • *
  • *

    * Amazon EC2 Auto Scaling consumes data points for the load metric over the last 14 days and creates an hourly load * forecast for predictive scaling. (A minimum of 24 hours of data is required.) *

    *
  • *
  • *

    * After creating the load forecast, Amazon EC2 Auto Scaling determines when to reduce or increase the capacity of your * Auto Scaling group in each hour of the forecast period so that the average number of requests received by each * instance is as close to 1000 requests per minute as possible at all times. *

    *
  • *
*

* For information about using custom metrics with predictive scaling, see Advanced predictive scaling policy configurations using custom metrics in the Amazon EC2 Auto Scaling User * Guide. *

*/ @Generated("software.amazon.awssdk:codegen") public final class PredictiveScalingMetricSpecification implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TARGET_VALUE_FIELD = SdkField. builder(MarshallingType.DOUBLE) .memberName("TargetValue").getter(getter(PredictiveScalingMetricSpecification::targetValue)) .setter(setter(Builder::targetValue)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetValue").build()).build(); private static final SdkField PREDEFINED_METRIC_PAIR_SPECIFICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("PredefinedMetricPairSpecification") .getter(getter(PredictiveScalingMetricSpecification::predefinedMetricPairSpecification)) .setter(setter(Builder::predefinedMetricPairSpecification)) .constructor(PredictiveScalingPredefinedMetricPair::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PredefinedMetricPairSpecification") .build()).build(); private static final SdkField PREDEFINED_SCALING_METRIC_SPECIFICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("PredefinedScalingMetricSpecification") .getter(getter(PredictiveScalingMetricSpecification::predefinedScalingMetricSpecification)) .setter(setter(Builder::predefinedScalingMetricSpecification)) .constructor(PredictiveScalingPredefinedScalingMetric::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("PredefinedScalingMetricSpecification").build()).build(); private static final SdkField PREDEFINED_LOAD_METRIC_SPECIFICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("PredefinedLoadMetricSpecification") .getter(getter(PredictiveScalingMetricSpecification::predefinedLoadMetricSpecification)) .setter(setter(Builder::predefinedLoadMetricSpecification)) .constructor(PredictiveScalingPredefinedLoadMetric::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PredefinedLoadMetricSpecification") .build()).build(); private static final SdkField CUSTOMIZED_SCALING_METRIC_SPECIFICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("CustomizedScalingMetricSpecification") .getter(getter(PredictiveScalingMetricSpecification::customizedScalingMetricSpecification)) .setter(setter(Builder::customizedScalingMetricSpecification)) .constructor(PredictiveScalingCustomizedScalingMetric::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("CustomizedScalingMetricSpecification").build()).build(); private static final SdkField CUSTOMIZED_LOAD_METRIC_SPECIFICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("CustomizedLoadMetricSpecification") .getter(getter(PredictiveScalingMetricSpecification::customizedLoadMetricSpecification)) .setter(setter(Builder::customizedLoadMetricSpecification)) .constructor(PredictiveScalingCustomizedLoadMetric::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CustomizedLoadMetricSpecification") .build()).build(); private static final SdkField CUSTOMIZED_CAPACITY_METRIC_SPECIFICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("CustomizedCapacityMetricSpecification") .getter(getter(PredictiveScalingMetricSpecification::customizedCapacityMetricSpecification)) .setter(setter(Builder::customizedCapacityMetricSpecification)) .constructor(PredictiveScalingCustomizedCapacityMetric::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("CustomizedCapacityMetricSpecification").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TARGET_VALUE_FIELD, PREDEFINED_METRIC_PAIR_SPECIFICATION_FIELD, PREDEFINED_SCALING_METRIC_SPECIFICATION_FIELD, PREDEFINED_LOAD_METRIC_SPECIFICATION_FIELD, CUSTOMIZED_SCALING_METRIC_SPECIFICATION_FIELD, CUSTOMIZED_LOAD_METRIC_SPECIFICATION_FIELD, CUSTOMIZED_CAPACITY_METRIC_SPECIFICATION_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("TargetValue", TARGET_VALUE_FIELD); put("PredefinedMetricPairSpecification", PREDEFINED_METRIC_PAIR_SPECIFICATION_FIELD); put("PredefinedScalingMetricSpecification", PREDEFINED_SCALING_METRIC_SPECIFICATION_FIELD); put("PredefinedLoadMetricSpecification", PREDEFINED_LOAD_METRIC_SPECIFICATION_FIELD); put("CustomizedScalingMetricSpecification", CUSTOMIZED_SCALING_METRIC_SPECIFICATION_FIELD); put("CustomizedLoadMetricSpecification", CUSTOMIZED_LOAD_METRIC_SPECIFICATION_FIELD); put("CustomizedCapacityMetricSpecification", CUSTOMIZED_CAPACITY_METRIC_SPECIFICATION_FIELD); } }); private static final long serialVersionUID = 1L; private final Double targetValue; private final PredictiveScalingPredefinedMetricPair predefinedMetricPairSpecification; private final PredictiveScalingPredefinedScalingMetric predefinedScalingMetricSpecification; private final PredictiveScalingPredefinedLoadMetric predefinedLoadMetricSpecification; private final PredictiveScalingCustomizedScalingMetric customizedScalingMetricSpecification; private final PredictiveScalingCustomizedLoadMetric customizedLoadMetricSpecification; private final PredictiveScalingCustomizedCapacityMetric customizedCapacityMetricSpecification; private PredictiveScalingMetricSpecification(BuilderImpl builder) { this.targetValue = builder.targetValue; this.predefinedMetricPairSpecification = builder.predefinedMetricPairSpecification; this.predefinedScalingMetricSpecification = builder.predefinedScalingMetricSpecification; this.predefinedLoadMetricSpecification = builder.predefinedLoadMetricSpecification; this.customizedScalingMetricSpecification = builder.customizedScalingMetricSpecification; this.customizedLoadMetricSpecification = builder.customizedLoadMetricSpecification; this.customizedCapacityMetricSpecification = builder.customizedCapacityMetricSpecification; } /** *

* Specifies the target utilization. *

* *

* Some metrics are based on a count instead of a percentage, such as the request count for an Application Load * Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify * the target utilization as the optimal average request or message count per instance during any one-minute * interval. *

*
* * @return Specifies the target utilization.

*

* Some metrics are based on a count instead of a percentage, such as the request count for an Application * Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these * metrics, specify the target utilization as the optimal average request or message count per instance * during any one-minute interval. *

*/ public final Double targetValue() { return targetValue; } /** *

* The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling * metric and load metric to use. *

* * @return The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate * scaling metric and load metric to use. */ public final PredictiveScalingPredefinedMetricPair predefinedMetricPairSpecification() { return predefinedMetricPairSpecification; } /** *

* The predefined scaling metric specification. *

* * @return The predefined scaling metric specification. */ public final PredictiveScalingPredefinedScalingMetric predefinedScalingMetricSpecification() { return predefinedScalingMetricSpecification; } /** *

* The predefined load metric specification. *

* * @return The predefined load metric specification. */ public final PredictiveScalingPredefinedLoadMetric predefinedLoadMetricSpecification() { return predefinedLoadMetricSpecification; } /** *

* The customized scaling metric specification. *

* * @return The customized scaling metric specification. */ public final PredictiveScalingCustomizedScalingMetric customizedScalingMetricSpecification() { return customizedScalingMetricSpecification; } /** *

* The customized load metric specification. *

* * @return The customized load metric specification. */ public final PredictiveScalingCustomizedLoadMetric customizedLoadMetricSpecification() { return customizedLoadMetricSpecification; } /** *

* The customized capacity metric specification. *

* * @return The customized capacity metric specification. */ public final PredictiveScalingCustomizedCapacityMetric customizedCapacityMetricSpecification() { return customizedCapacityMetricSpecification; } @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(targetValue()); hashCode = 31 * hashCode + Objects.hashCode(predefinedMetricPairSpecification()); hashCode = 31 * hashCode + Objects.hashCode(predefinedScalingMetricSpecification()); hashCode = 31 * hashCode + Objects.hashCode(predefinedLoadMetricSpecification()); hashCode = 31 * hashCode + Objects.hashCode(customizedScalingMetricSpecification()); hashCode = 31 * hashCode + Objects.hashCode(customizedLoadMetricSpecification()); hashCode = 31 * hashCode + Objects.hashCode(customizedCapacityMetricSpecification()); 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 PredictiveScalingMetricSpecification)) { return false; } PredictiveScalingMetricSpecification other = (PredictiveScalingMetricSpecification) obj; return Objects.equals(targetValue(), other.targetValue()) && Objects.equals(predefinedMetricPairSpecification(), other.predefinedMetricPairSpecification()) && Objects.equals(predefinedScalingMetricSpecification(), other.predefinedScalingMetricSpecification()) && Objects.equals(predefinedLoadMetricSpecification(), other.predefinedLoadMetricSpecification()) && Objects.equals(customizedScalingMetricSpecification(), other.customizedScalingMetricSpecification()) && Objects.equals(customizedLoadMetricSpecification(), other.customizedLoadMetricSpecification()) && Objects.equals(customizedCapacityMetricSpecification(), other.customizedCapacityMetricSpecification()); } /** * 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("PredictiveScalingMetricSpecification").add("TargetValue", targetValue()) .add("PredefinedMetricPairSpecification", predefinedMetricPairSpecification()) .add("PredefinedScalingMetricSpecification", predefinedScalingMetricSpecification()) .add("PredefinedLoadMetricSpecification", predefinedLoadMetricSpecification()) .add("CustomizedScalingMetricSpecification", customizedScalingMetricSpecification()) .add("CustomizedLoadMetricSpecification", customizedLoadMetricSpecification()) .add("CustomizedCapacityMetricSpecification", customizedCapacityMetricSpecification()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "TargetValue": return Optional.ofNullable(clazz.cast(targetValue())); case "PredefinedMetricPairSpecification": return Optional.ofNullable(clazz.cast(predefinedMetricPairSpecification())); case "PredefinedScalingMetricSpecification": return Optional.ofNullable(clazz.cast(predefinedScalingMetricSpecification())); case "PredefinedLoadMetricSpecification": return Optional.ofNullable(clazz.cast(predefinedLoadMetricSpecification())); case "CustomizedScalingMetricSpecification": return Optional.ofNullable(clazz.cast(customizedScalingMetricSpecification())); case "CustomizedLoadMetricSpecification": return Optional.ofNullable(clazz.cast(customizedLoadMetricSpecification())); case "CustomizedCapacityMetricSpecification": return Optional.ofNullable(clazz.cast(customizedCapacityMetricSpecification())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((PredictiveScalingMetricSpecification) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Specifies the target utilization. *

* *

* Some metrics are based on a count instead of a percentage, such as the request count for an Application Load * Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, * specify the target utilization as the optimal average request or message count per instance during any * one-minute interval. *

*
* * @param targetValue * Specifies the target utilization.

*

* Some metrics are based on a count instead of a percentage, such as the request count for an * Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies * one of these metrics, specify the target utilization as the optimal average request or message count * per instance during any one-minute interval. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder targetValue(Double targetValue); /** *

* The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate * scaling metric and load metric to use. *

* * @param predefinedMetricPairSpecification * The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate * scaling metric and load metric to use. * @return Returns a reference to this object so that method calls can be chained together. */ Builder predefinedMetricPairSpecification(PredictiveScalingPredefinedMetricPair predefinedMetricPairSpecification); /** *

* The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate * scaling metric and load metric to use. *

* This is a convenience method that creates an instance of the * {@link PredictiveScalingPredefinedMetricPair.Builder} avoiding the need to create one manually via * {@link PredictiveScalingPredefinedMetricPair#builder()}. * *

* When the {@link Consumer} completes, {@link PredictiveScalingPredefinedMetricPair.Builder#build()} is called * immediately and its result is passed to * {@link #predefinedMetricPairSpecification(PredictiveScalingPredefinedMetricPair)}. * * @param predefinedMetricPairSpecification * a consumer that will call methods on {@link PredictiveScalingPredefinedMetricPair.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #predefinedMetricPairSpecification(PredictiveScalingPredefinedMetricPair) */ default Builder predefinedMetricPairSpecification( Consumer predefinedMetricPairSpecification) { return predefinedMetricPairSpecification(PredictiveScalingPredefinedMetricPair.builder() .applyMutation(predefinedMetricPairSpecification).build()); } /** *

* The predefined scaling metric specification. *

* * @param predefinedScalingMetricSpecification * The predefined scaling metric specification. * @return Returns a reference to this object so that method calls can be chained together. */ Builder predefinedScalingMetricSpecification(PredictiveScalingPredefinedScalingMetric predefinedScalingMetricSpecification); /** *

* The predefined scaling metric specification. *

* This is a convenience method that creates an instance of the * {@link PredictiveScalingPredefinedScalingMetric.Builder} avoiding the need to create one manually via * {@link PredictiveScalingPredefinedScalingMetric#builder()}. * *

* When the {@link Consumer} completes, {@link PredictiveScalingPredefinedScalingMetric.Builder#build()} is * called immediately and its result is passed to * {@link #predefinedScalingMetricSpecification(PredictiveScalingPredefinedScalingMetric)}. * * @param predefinedScalingMetricSpecification * a consumer that will call methods on {@link PredictiveScalingPredefinedScalingMetric.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #predefinedScalingMetricSpecification(PredictiveScalingPredefinedScalingMetric) */ default Builder predefinedScalingMetricSpecification( Consumer predefinedScalingMetricSpecification) { return predefinedScalingMetricSpecification(PredictiveScalingPredefinedScalingMetric.builder() .applyMutation(predefinedScalingMetricSpecification).build()); } /** *

* The predefined load metric specification. *

* * @param predefinedLoadMetricSpecification * The predefined load metric specification. * @return Returns a reference to this object so that method calls can be chained together. */ Builder predefinedLoadMetricSpecification(PredictiveScalingPredefinedLoadMetric predefinedLoadMetricSpecification); /** *

* The predefined load metric specification. *

* This is a convenience method that creates an instance of the * {@link PredictiveScalingPredefinedLoadMetric.Builder} avoiding the need to create one manually via * {@link PredictiveScalingPredefinedLoadMetric#builder()}. * *

* When the {@link Consumer} completes, {@link PredictiveScalingPredefinedLoadMetric.Builder#build()} is called * immediately and its result is passed to * {@link #predefinedLoadMetricSpecification(PredictiveScalingPredefinedLoadMetric)}. * * @param predefinedLoadMetricSpecification * a consumer that will call methods on {@link PredictiveScalingPredefinedLoadMetric.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #predefinedLoadMetricSpecification(PredictiveScalingPredefinedLoadMetric) */ default Builder predefinedLoadMetricSpecification( Consumer predefinedLoadMetricSpecification) { return predefinedLoadMetricSpecification(PredictiveScalingPredefinedLoadMetric.builder() .applyMutation(predefinedLoadMetricSpecification).build()); } /** *

* The customized scaling metric specification. *

* * @param customizedScalingMetricSpecification * The customized scaling metric specification. * @return Returns a reference to this object so that method calls can be chained together. */ Builder customizedScalingMetricSpecification(PredictiveScalingCustomizedScalingMetric customizedScalingMetricSpecification); /** *

* The customized scaling metric specification. *

* This is a convenience method that creates an instance of the * {@link PredictiveScalingCustomizedScalingMetric.Builder} avoiding the need to create one manually via * {@link PredictiveScalingCustomizedScalingMetric#builder()}. * *

* When the {@link Consumer} completes, {@link PredictiveScalingCustomizedScalingMetric.Builder#build()} is * called immediately and its result is passed to * {@link #customizedScalingMetricSpecification(PredictiveScalingCustomizedScalingMetric)}. * * @param customizedScalingMetricSpecification * a consumer that will call methods on {@link PredictiveScalingCustomizedScalingMetric.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #customizedScalingMetricSpecification(PredictiveScalingCustomizedScalingMetric) */ default Builder customizedScalingMetricSpecification( Consumer customizedScalingMetricSpecification) { return customizedScalingMetricSpecification(PredictiveScalingCustomizedScalingMetric.builder() .applyMutation(customizedScalingMetricSpecification).build()); } /** *

* The customized load metric specification. *

* * @param customizedLoadMetricSpecification * The customized load metric specification. * @return Returns a reference to this object so that method calls can be chained together. */ Builder customizedLoadMetricSpecification(PredictiveScalingCustomizedLoadMetric customizedLoadMetricSpecification); /** *

* The customized load metric specification. *

* This is a convenience method that creates an instance of the * {@link PredictiveScalingCustomizedLoadMetric.Builder} avoiding the need to create one manually via * {@link PredictiveScalingCustomizedLoadMetric#builder()}. * *

* When the {@link Consumer} completes, {@link PredictiveScalingCustomizedLoadMetric.Builder#build()} is called * immediately and its result is passed to * {@link #customizedLoadMetricSpecification(PredictiveScalingCustomizedLoadMetric)}. * * @param customizedLoadMetricSpecification * a consumer that will call methods on {@link PredictiveScalingCustomizedLoadMetric.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #customizedLoadMetricSpecification(PredictiveScalingCustomizedLoadMetric) */ default Builder customizedLoadMetricSpecification( Consumer customizedLoadMetricSpecification) { return customizedLoadMetricSpecification(PredictiveScalingCustomizedLoadMetric.builder() .applyMutation(customizedLoadMetricSpecification).build()); } /** *

* The customized capacity metric specification. *

* * @param customizedCapacityMetricSpecification * The customized capacity metric specification. * @return Returns a reference to this object so that method calls can be chained together. */ Builder customizedCapacityMetricSpecification( PredictiveScalingCustomizedCapacityMetric customizedCapacityMetricSpecification); /** *

* The customized capacity metric specification. *

* This is a convenience method that creates an instance of the * {@link PredictiveScalingCustomizedCapacityMetric.Builder} avoiding the need to create one manually via * {@link PredictiveScalingCustomizedCapacityMetric#builder()}. * *

* When the {@link Consumer} completes, {@link PredictiveScalingCustomizedCapacityMetric.Builder#build()} is * called immediately and its result is passed to * {@link #customizedCapacityMetricSpecification(PredictiveScalingCustomizedCapacityMetric)}. * * @param customizedCapacityMetricSpecification * a consumer that will call methods on {@link PredictiveScalingCustomizedCapacityMetric.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #customizedCapacityMetricSpecification(PredictiveScalingCustomizedCapacityMetric) */ default Builder customizedCapacityMetricSpecification( Consumer customizedCapacityMetricSpecification) { return customizedCapacityMetricSpecification(PredictiveScalingCustomizedCapacityMetric.builder() .applyMutation(customizedCapacityMetricSpecification).build()); } } static final class BuilderImpl implements Builder { private Double targetValue; private PredictiveScalingPredefinedMetricPair predefinedMetricPairSpecification; private PredictiveScalingPredefinedScalingMetric predefinedScalingMetricSpecification; private PredictiveScalingPredefinedLoadMetric predefinedLoadMetricSpecification; private PredictiveScalingCustomizedScalingMetric customizedScalingMetricSpecification; private PredictiveScalingCustomizedLoadMetric customizedLoadMetricSpecification; private PredictiveScalingCustomizedCapacityMetric customizedCapacityMetricSpecification; private BuilderImpl() { } private BuilderImpl(PredictiveScalingMetricSpecification model) { targetValue(model.targetValue); predefinedMetricPairSpecification(model.predefinedMetricPairSpecification); predefinedScalingMetricSpecification(model.predefinedScalingMetricSpecification); predefinedLoadMetricSpecification(model.predefinedLoadMetricSpecification); customizedScalingMetricSpecification(model.customizedScalingMetricSpecification); customizedLoadMetricSpecification(model.customizedLoadMetricSpecification); customizedCapacityMetricSpecification(model.customizedCapacityMetricSpecification); } public final Double getTargetValue() { return targetValue; } public final void setTargetValue(Double targetValue) { this.targetValue = targetValue; } @Override public final Builder targetValue(Double targetValue) { this.targetValue = targetValue; return this; } public final PredictiveScalingPredefinedMetricPair.Builder getPredefinedMetricPairSpecification() { return predefinedMetricPairSpecification != null ? predefinedMetricPairSpecification.toBuilder() : null; } public final void setPredefinedMetricPairSpecification( PredictiveScalingPredefinedMetricPair.BuilderImpl predefinedMetricPairSpecification) { this.predefinedMetricPairSpecification = predefinedMetricPairSpecification != null ? predefinedMetricPairSpecification .build() : null; } @Override public final Builder predefinedMetricPairSpecification( PredictiveScalingPredefinedMetricPair predefinedMetricPairSpecification) { this.predefinedMetricPairSpecification = predefinedMetricPairSpecification; return this; } public final PredictiveScalingPredefinedScalingMetric.Builder getPredefinedScalingMetricSpecification() { return predefinedScalingMetricSpecification != null ? predefinedScalingMetricSpecification.toBuilder() : null; } public final void setPredefinedScalingMetricSpecification( PredictiveScalingPredefinedScalingMetric.BuilderImpl predefinedScalingMetricSpecification) { this.predefinedScalingMetricSpecification = predefinedScalingMetricSpecification != null ? predefinedScalingMetricSpecification .build() : null; } @Override public final Builder predefinedScalingMetricSpecification( PredictiveScalingPredefinedScalingMetric predefinedScalingMetricSpecification) { this.predefinedScalingMetricSpecification = predefinedScalingMetricSpecification; return this; } public final PredictiveScalingPredefinedLoadMetric.Builder getPredefinedLoadMetricSpecification() { return predefinedLoadMetricSpecification != null ? predefinedLoadMetricSpecification.toBuilder() : null; } public final void setPredefinedLoadMetricSpecification( PredictiveScalingPredefinedLoadMetric.BuilderImpl predefinedLoadMetricSpecification) { this.predefinedLoadMetricSpecification = predefinedLoadMetricSpecification != null ? predefinedLoadMetricSpecification .build() : null; } @Override public final Builder predefinedLoadMetricSpecification( PredictiveScalingPredefinedLoadMetric predefinedLoadMetricSpecification) { this.predefinedLoadMetricSpecification = predefinedLoadMetricSpecification; return this; } public final PredictiveScalingCustomizedScalingMetric.Builder getCustomizedScalingMetricSpecification() { return customizedScalingMetricSpecification != null ? customizedScalingMetricSpecification.toBuilder() : null; } public final void setCustomizedScalingMetricSpecification( PredictiveScalingCustomizedScalingMetric.BuilderImpl customizedScalingMetricSpecification) { this.customizedScalingMetricSpecification = customizedScalingMetricSpecification != null ? customizedScalingMetricSpecification .build() : null; } @Override public final Builder customizedScalingMetricSpecification( PredictiveScalingCustomizedScalingMetric customizedScalingMetricSpecification) { this.customizedScalingMetricSpecification = customizedScalingMetricSpecification; return this; } public final PredictiveScalingCustomizedLoadMetric.Builder getCustomizedLoadMetricSpecification() { return customizedLoadMetricSpecification != null ? customizedLoadMetricSpecification.toBuilder() : null; } public final void setCustomizedLoadMetricSpecification( PredictiveScalingCustomizedLoadMetric.BuilderImpl customizedLoadMetricSpecification) { this.customizedLoadMetricSpecification = customizedLoadMetricSpecification != null ? customizedLoadMetricSpecification .build() : null; } @Override public final Builder customizedLoadMetricSpecification( PredictiveScalingCustomizedLoadMetric customizedLoadMetricSpecification) { this.customizedLoadMetricSpecification = customizedLoadMetricSpecification; return this; } public final PredictiveScalingCustomizedCapacityMetric.Builder getCustomizedCapacityMetricSpecification() { return customizedCapacityMetricSpecification != null ? customizedCapacityMetricSpecification.toBuilder() : null; } public final void setCustomizedCapacityMetricSpecification( PredictiveScalingCustomizedCapacityMetric.BuilderImpl customizedCapacityMetricSpecification) { this.customizedCapacityMetricSpecification = customizedCapacityMetricSpecification != null ? customizedCapacityMetricSpecification .build() : null; } @Override public final Builder customizedCapacityMetricSpecification( PredictiveScalingCustomizedCapacityMetric customizedCapacityMetricSpecification) { this.customizedCapacityMetricSpecification = customizedCapacityMetricSpecification; return this; } @Override public PredictiveScalingMetricSpecification build() { return new PredictiveScalingMetricSpecification(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy