
software.amazon.awssdk.services.iot.model.ExponentialRolloutRate 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.iot.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.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;
/**
*
* Allows you to create an exponential rate of rollout for a job.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ExponentialRolloutRate implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField BASE_RATE_PER_MINUTE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("baseRatePerMinute").getter(getter(ExponentialRolloutRate::baseRatePerMinute))
.setter(setter(Builder::baseRatePerMinute))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("baseRatePerMinute").build()).build();
private static final SdkField INCREMENT_FACTOR_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("incrementFactor").getter(getter(ExponentialRolloutRate::incrementFactor))
.setter(setter(Builder::incrementFactor))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("incrementFactor").build()).build();
private static final SdkField RATE_INCREASE_CRITERIA_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("rateIncreaseCriteria")
.getter(getter(ExponentialRolloutRate::rateIncreaseCriteria)).setter(setter(Builder::rateIncreaseCriteria))
.constructor(RateIncreaseCriteria::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("rateIncreaseCriteria").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BASE_RATE_PER_MINUTE_FIELD,
INCREMENT_FACTOR_FIELD, RATE_INCREASE_CRITERIA_FIELD));
private static final long serialVersionUID = 1L;
private final Integer baseRatePerMinute;
private final Double incrementFactor;
private final RateIncreaseCriteria rateIncreaseCriteria;
private ExponentialRolloutRate(BuilderImpl builder) {
this.baseRatePerMinute = builder.baseRatePerMinute;
this.incrementFactor = builder.incrementFactor;
this.rateIncreaseCriteria = builder.rateIncreaseCriteria;
}
/**
*
* The minimum number of things that will be notified of a pending job, per minute at the start of job rollout. This
* parameter allows you to define the initial rate of rollout.
*
*
* @return The minimum number of things that will be notified of a pending job, per minute at the start of job
* rollout. This parameter allows you to define the initial rate of rollout.
*/
public final Integer baseRatePerMinute() {
return baseRatePerMinute;
}
/**
*
* The exponential factor to increase the rate of rollout for a job.
*
*
* Amazon Web Services IoT Core supports up to one digit after the decimal (for example, 1.5, but not 1.55).
*
*
* @return The exponential factor to increase the rate of rollout for a job.
*
* Amazon Web Services IoT Core supports up to one digit after the decimal (for example, 1.5, but not 1.55).
*/
public final Double incrementFactor() {
return incrementFactor;
}
/**
*
* The criteria to initiate the increase in rate of rollout for a job.
*
*
* @return The criteria to initiate the increase in rate of rollout for a job.
*/
public final RateIncreaseCriteria rateIncreaseCriteria() {
return rateIncreaseCriteria;
}
@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 + Objects.hashCode(baseRatePerMinute());
hashCode = 31 * hashCode + Objects.hashCode(incrementFactor());
hashCode = 31 * hashCode + Objects.hashCode(rateIncreaseCriteria());
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 ExponentialRolloutRate)) {
return false;
}
ExponentialRolloutRate other = (ExponentialRolloutRate) obj;
return Objects.equals(baseRatePerMinute(), other.baseRatePerMinute())
&& Objects.equals(incrementFactor(), other.incrementFactor())
&& Objects.equals(rateIncreaseCriteria(), other.rateIncreaseCriteria());
}
/**
* 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("ExponentialRolloutRate").add("BaseRatePerMinute", baseRatePerMinute())
.add("IncrementFactor", incrementFactor()).add("RateIncreaseCriteria", rateIncreaseCriteria()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "baseRatePerMinute":
return Optional.ofNullable(clazz.cast(baseRatePerMinute()));
case "incrementFactor":
return Optional.ofNullable(clazz.cast(incrementFactor()));
case "rateIncreaseCriteria":
return Optional.ofNullable(clazz.cast(rateIncreaseCriteria()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function