
software.amazon.awssdk.services.kafkaconnect.model.AutoScalingUpdate 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.kafkaconnect.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;
/**
*
* The updates to the auto scaling parameters for the connector.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AutoScalingUpdate implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField MAX_WORKER_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("maxWorkerCount").getter(getter(AutoScalingUpdate::maxWorkerCount))
.setter(setter(Builder::maxWorkerCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("maxWorkerCount").build()).build();
private static final SdkField MCU_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("mcuCount").getter(getter(AutoScalingUpdate::mcuCount)).setter(setter(Builder::mcuCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("mcuCount").build()).build();
private static final SdkField MIN_WORKER_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("minWorkerCount").getter(getter(AutoScalingUpdate::minWorkerCount))
.setter(setter(Builder::minWorkerCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("minWorkerCount").build()).build();
private static final SdkField SCALE_IN_POLICY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("scaleInPolicy")
.getter(getter(AutoScalingUpdate::scaleInPolicy)).setter(setter(Builder::scaleInPolicy))
.constructor(ScaleInPolicyUpdate::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("scaleInPolicy").build()).build();
private static final SdkField SCALE_OUT_POLICY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("scaleOutPolicy")
.getter(getter(AutoScalingUpdate::scaleOutPolicy)).setter(setter(Builder::scaleOutPolicy))
.constructor(ScaleOutPolicyUpdate::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("scaleOutPolicy").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MAX_WORKER_COUNT_FIELD,
MCU_COUNT_FIELD, MIN_WORKER_COUNT_FIELD, SCALE_IN_POLICY_FIELD, SCALE_OUT_POLICY_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("maxWorkerCount", MAX_WORKER_COUNT_FIELD);
put("mcuCount", MCU_COUNT_FIELD);
put("minWorkerCount", MIN_WORKER_COUNT_FIELD);
put("scaleInPolicy", SCALE_IN_POLICY_FIELD);
put("scaleOutPolicy", SCALE_OUT_POLICY_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final Integer maxWorkerCount;
private final Integer mcuCount;
private final Integer minWorkerCount;
private final ScaleInPolicyUpdate scaleInPolicy;
private final ScaleOutPolicyUpdate scaleOutPolicy;
private AutoScalingUpdate(BuilderImpl builder) {
this.maxWorkerCount = builder.maxWorkerCount;
this.mcuCount = builder.mcuCount;
this.minWorkerCount = builder.minWorkerCount;
this.scaleInPolicy = builder.scaleInPolicy;
this.scaleOutPolicy = builder.scaleOutPolicy;
}
/**
*
* The target maximum number of workers allocated to the connector.
*
*
* @return The target maximum number of workers allocated to the connector.
*/
public final Integer maxWorkerCount() {
return maxWorkerCount;
}
/**
*
* The target number of microcontroller units (MCUs) allocated to each connector worker. The valid values are
* 1,2,4,8.
*
*
* @return The target number of microcontroller units (MCUs) allocated to each connector worker. The valid values
* are 1,2,4,8.
*/
public final Integer mcuCount() {
return mcuCount;
}
/**
*
* The target minimum number of workers allocated to the connector.
*
*
* @return The target minimum number of workers allocated to the connector.
*/
public final Integer minWorkerCount() {
return minWorkerCount;
}
/**
*
* The target sacle-in policy for the connector.
*
*
* @return The target sacle-in policy for the connector.
*/
public final ScaleInPolicyUpdate scaleInPolicy() {
return scaleInPolicy;
}
/**
*
* The target sacle-out policy for the connector.
*
*
* @return The target sacle-out policy for the connector.
*/
public final ScaleOutPolicyUpdate scaleOutPolicy() {
return scaleOutPolicy;
}
@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(maxWorkerCount());
hashCode = 31 * hashCode + Objects.hashCode(mcuCount());
hashCode = 31 * hashCode + Objects.hashCode(minWorkerCount());
hashCode = 31 * hashCode + Objects.hashCode(scaleInPolicy());
hashCode = 31 * hashCode + Objects.hashCode(scaleOutPolicy());
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 AutoScalingUpdate)) {
return false;
}
AutoScalingUpdate other = (AutoScalingUpdate) obj;
return Objects.equals(maxWorkerCount(), other.maxWorkerCount()) && Objects.equals(mcuCount(), other.mcuCount())
&& Objects.equals(minWorkerCount(), other.minWorkerCount())
&& Objects.equals(scaleInPolicy(), other.scaleInPolicy())
&& Objects.equals(scaleOutPolicy(), other.scaleOutPolicy());
}
/**
* 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("AutoScalingUpdate").add("MaxWorkerCount", maxWorkerCount()).add("McuCount", mcuCount())
.add("MinWorkerCount", minWorkerCount()).add("ScaleInPolicy", scaleInPolicy())
.add("ScaleOutPolicy", scaleOutPolicy()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "maxWorkerCount":
return Optional.ofNullable(clazz.cast(maxWorkerCount()));
case "mcuCount":
return Optional.ofNullable(clazz.cast(mcuCount()));
case "minWorkerCount":
return Optional.ofNullable(clazz.cast(minWorkerCount()));
case "scaleInPolicy":
return Optional.ofNullable(clazz.cast(scaleInPolicy()));
case "scaleOutPolicy":
return Optional.ofNullable(clazz.cast(scaleOutPolicy()));
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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy