
software.amazon.awssdk.services.kafka.model.MutableClusterInfo 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.kafka.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*
* Information about cluster attributes that can be updated via update APIs.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class MutableClusterInfo implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField> BROKER_EBS_VOLUME_INFO_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("BrokerEBSVolumeInfo")
.getter(getter(MutableClusterInfo::brokerEBSVolumeInfo))
.setter(setter(Builder::brokerEBSVolumeInfo))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("brokerEBSVolumeInfo").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(BrokerEBSVolumeInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CONFIGURATION_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ConfigurationInfo")
.getter(getter(MutableClusterInfo::configurationInfo)).setter(setter(Builder::configurationInfo))
.constructor(ConfigurationInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("configurationInfo").build()).build();
private static final SdkField NUMBER_OF_BROKER_NODES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("NumberOfBrokerNodes").getter(getter(MutableClusterInfo::numberOfBrokerNodes))
.setter(setter(Builder::numberOfBrokerNodes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("numberOfBrokerNodes").build())
.build();
private static final SdkField ENHANCED_MONITORING_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EnhancedMonitoring").getter(getter(MutableClusterInfo::enhancedMonitoringAsString))
.setter(setter(Builder::enhancedMonitoring))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("enhancedMonitoring").build())
.build();
private static final SdkField OPEN_MONITORING_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("OpenMonitoring")
.getter(getter(MutableClusterInfo::openMonitoring)).setter(setter(Builder::openMonitoring))
.constructor(OpenMonitoring::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("openMonitoring").build()).build();
private static final SdkField KAFKA_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KafkaVersion").getter(getter(MutableClusterInfo::kafkaVersion)).setter(setter(Builder::kafkaVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kafkaVersion").build()).build();
private static final SdkField LOGGING_INFO_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("LoggingInfo").getter(getter(MutableClusterInfo::loggingInfo)).setter(setter(Builder::loggingInfo))
.constructor(LoggingInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("loggingInfo").build()).build();
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceType").getter(getter(MutableClusterInfo::instanceType)).setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("instanceType").build()).build();
private static final SdkField CLIENT_AUTHENTICATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ClientAuthentication")
.getter(getter(MutableClusterInfo::clientAuthentication)).setter(setter(Builder::clientAuthentication))
.constructor(ClientAuthentication::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientAuthentication").build())
.build();
private static final SdkField ENCRYPTION_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("EncryptionInfo")
.getter(getter(MutableClusterInfo::encryptionInfo)).setter(setter(Builder::encryptionInfo))
.constructor(EncryptionInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("encryptionInfo").build()).build();
private static final SdkField CONNECTIVITY_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ConnectivityInfo")
.getter(getter(MutableClusterInfo::connectivityInfo)).setter(setter(Builder::connectivityInfo))
.constructor(ConnectivityInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectivityInfo").build()).build();
private static final SdkField STORAGE_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StorageMode").getter(getter(MutableClusterInfo::storageModeAsString))
.setter(setter(Builder::storageMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("storageMode").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BROKER_EBS_VOLUME_INFO_FIELD,
CONFIGURATION_INFO_FIELD, NUMBER_OF_BROKER_NODES_FIELD, ENHANCED_MONITORING_FIELD, OPEN_MONITORING_FIELD,
KAFKA_VERSION_FIELD, LOGGING_INFO_FIELD, INSTANCE_TYPE_FIELD, CLIENT_AUTHENTICATION_FIELD, ENCRYPTION_INFO_FIELD,
CONNECTIVITY_INFO_FIELD, STORAGE_MODE_FIELD));
private static final long serialVersionUID = 1L;
private final List brokerEBSVolumeInfo;
private final ConfigurationInfo configurationInfo;
private final Integer numberOfBrokerNodes;
private final String enhancedMonitoring;
private final OpenMonitoring openMonitoring;
private final String kafkaVersion;
private final LoggingInfo loggingInfo;
private final String instanceType;
private final ClientAuthentication clientAuthentication;
private final EncryptionInfo encryptionInfo;
private final ConnectivityInfo connectivityInfo;
private final String storageMode;
private MutableClusterInfo(BuilderImpl builder) {
this.brokerEBSVolumeInfo = builder.brokerEBSVolumeInfo;
this.configurationInfo = builder.configurationInfo;
this.numberOfBrokerNodes = builder.numberOfBrokerNodes;
this.enhancedMonitoring = builder.enhancedMonitoring;
this.openMonitoring = builder.openMonitoring;
this.kafkaVersion = builder.kafkaVersion;
this.loggingInfo = builder.loggingInfo;
this.instanceType = builder.instanceType;
this.clientAuthentication = builder.clientAuthentication;
this.encryptionInfo = builder.encryptionInfo;
this.connectivityInfo = builder.connectivityInfo;
this.storageMode = builder.storageMode;
}
/**
* For responses, this returns true if the service returned a value for the BrokerEBSVolumeInfo property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasBrokerEBSVolumeInfo() {
return brokerEBSVolumeInfo != null && !(brokerEBSVolumeInfo instanceof SdkAutoConstructList);
}
/**
*
*
* Specifies the size of the EBS volume and the ID of the associated broker.
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasBrokerEBSVolumeInfo} method.
*
*
* @return
* Specifies the size of the EBS volume and the ID of the associated broker.
*
*/
public final List brokerEBSVolumeInfo() {
return brokerEBSVolumeInfo;
}
/**
*
*
* Information about the changes in the configuration of the brokers.
*
*
* @return
* Information about the changes in the configuration of the brokers.
*
*/
public final ConfigurationInfo configurationInfo() {
return configurationInfo;
}
/**
*
*
* The number of broker nodes in the cluster.
*
*
* @return
* The number of broker nodes in the cluster.
*
*/
public final Integer numberOfBrokerNodes() {
return numberOfBrokerNodes;
}
/**
*
*
* Specifies which Apache Kafka metrics Amazon MSK gathers and sends to Amazon CloudWatch for this cluster.
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #enhancedMonitoring} will return {@link EnhancedMonitoring#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #enhancedMonitoringAsString}.
*
*
* @return
* Specifies which Apache Kafka metrics Amazon MSK gathers and sends to Amazon CloudWatch for this cluster.
*
* @see EnhancedMonitoring
*/
public final EnhancedMonitoring enhancedMonitoring() {
return EnhancedMonitoring.fromValue(enhancedMonitoring);
}
/**
*
*
* Specifies which Apache Kafka metrics Amazon MSK gathers and sends to Amazon CloudWatch for this cluster.
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #enhancedMonitoring} will return {@link EnhancedMonitoring#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #enhancedMonitoringAsString}.
*
*
* @return
* Specifies which Apache Kafka metrics Amazon MSK gathers and sends to Amazon CloudWatch for this cluster.
*
* @see EnhancedMonitoring
*/
public final String enhancedMonitoringAsString() {
return enhancedMonitoring;
}
/**
*
*
* The settings for open monitoring.
*
*
* @return
* The settings for open monitoring.
*
*/
public final OpenMonitoring openMonitoring() {
return openMonitoring;
}
/**
*
*
* The Apache Kafka version.
*
*
* @return
* The Apache Kafka version.
*
*/
public final String kafkaVersion() {
return kafkaVersion;
}
/**
*
*
* You can configure your MSK cluster to send broker logs to different destination types. This is a container for
* the configuration details related to broker logs.
*
*
* @return
* You can configure your MSK cluster to send broker logs to different destination types. This is a
* container for the configuration details related to broker logs.
*
*/
public final LoggingInfo loggingInfo() {
return loggingInfo;
}
/**
*
*
* Information about the Amazon MSK broker type.
*
*
* @return
* Information about the Amazon MSK broker type.
*
*/
public final String instanceType() {
return instanceType;
}
/**
*
*
* Includes all client authentication information.
*
*
* @return
* Includes all client authentication information.
*
*/
public final ClientAuthentication clientAuthentication() {
return clientAuthentication;
}
/**
*
*
* Includes all encryption-related information.
*
*
* @return
* Includes all encryption-related information.
*
*/
public final EncryptionInfo encryptionInfo() {
return encryptionInfo;
}
/**
*
*
* Information about the broker access configuration.
*
*
* @return
* Information about the broker access configuration.
*
*/
public final ConnectivityInfo connectivityInfo() {
return connectivityInfo;
}
/**
*
*
* This controls storage mode for supported storage tiers.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #storageMode} will
* return {@link StorageMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #storageModeAsString}.
*
*
* @return
* This controls storage mode for supported storage tiers.
*
* @see StorageMode
*/
public final StorageMode storageMode() {
return StorageMode.fromValue(storageMode);
}
/**
*
*
* This controls storage mode for supported storage tiers.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #storageMode} will
* return {@link StorageMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #storageModeAsString}.
*
*
* @return
* This controls storage mode for supported storage tiers.
*
* @see StorageMode
*/
public final String storageModeAsString() {
return storageMode;
}
@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(hasBrokerEBSVolumeInfo() ? brokerEBSVolumeInfo() : null);
hashCode = 31 * hashCode + Objects.hashCode(configurationInfo());
hashCode = 31 * hashCode + Objects.hashCode(numberOfBrokerNodes());
hashCode = 31 * hashCode + Objects.hashCode(enhancedMonitoringAsString());
hashCode = 31 * hashCode + Objects.hashCode(openMonitoring());
hashCode = 31 * hashCode + Objects.hashCode(kafkaVersion());
hashCode = 31 * hashCode + Objects.hashCode(loggingInfo());
hashCode = 31 * hashCode + Objects.hashCode(instanceType());
hashCode = 31 * hashCode + Objects.hashCode(clientAuthentication());
hashCode = 31 * hashCode + Objects.hashCode(encryptionInfo());
hashCode = 31 * hashCode + Objects.hashCode(connectivityInfo());
hashCode = 31 * hashCode + Objects.hashCode(storageModeAsString());
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 MutableClusterInfo)) {
return false;
}
MutableClusterInfo other = (MutableClusterInfo) obj;
return hasBrokerEBSVolumeInfo() == other.hasBrokerEBSVolumeInfo()
&& Objects.equals(brokerEBSVolumeInfo(), other.brokerEBSVolumeInfo())
&& Objects.equals(configurationInfo(), other.configurationInfo())
&& Objects.equals(numberOfBrokerNodes(), other.numberOfBrokerNodes())
&& Objects.equals(enhancedMonitoringAsString(), other.enhancedMonitoringAsString())
&& Objects.equals(openMonitoring(), other.openMonitoring())
&& Objects.equals(kafkaVersion(), other.kafkaVersion()) && Objects.equals(loggingInfo(), other.loggingInfo())
&& Objects.equals(instanceType(), other.instanceType())
&& Objects.equals(clientAuthentication(), other.clientAuthentication())
&& Objects.equals(encryptionInfo(), other.encryptionInfo())
&& Objects.equals(connectivityInfo(), other.connectivityInfo())
&& Objects.equals(storageModeAsString(), other.storageModeAsString());
}
/**
* 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("MutableClusterInfo")
.add("BrokerEBSVolumeInfo", hasBrokerEBSVolumeInfo() ? brokerEBSVolumeInfo() : null)
.add("ConfigurationInfo", configurationInfo()).add("NumberOfBrokerNodes", numberOfBrokerNodes())
.add("EnhancedMonitoring", enhancedMonitoringAsString()).add("OpenMonitoring", openMonitoring())
.add("KafkaVersion", kafkaVersion()).add("LoggingInfo", loggingInfo()).add("InstanceType", instanceType())
.add("ClientAuthentication", clientAuthentication()).add("EncryptionInfo", encryptionInfo())
.add("ConnectivityInfo", connectivityInfo()).add("StorageMode", storageModeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BrokerEBSVolumeInfo":
return Optional.ofNullable(clazz.cast(brokerEBSVolumeInfo()));
case "ConfigurationInfo":
return Optional.ofNullable(clazz.cast(configurationInfo()));
case "NumberOfBrokerNodes":
return Optional.ofNullable(clazz.cast(numberOfBrokerNodes()));
case "EnhancedMonitoring":
return Optional.ofNullable(clazz.cast(enhancedMonitoringAsString()));
case "OpenMonitoring":
return Optional.ofNullable(clazz.cast(openMonitoring()));
case "KafkaVersion":
return Optional.ofNullable(clazz.cast(kafkaVersion()));
case "LoggingInfo":
return Optional.ofNullable(clazz.cast(loggingInfo()));
case "InstanceType":
return Optional.ofNullable(clazz.cast(instanceType()));
case "ClientAuthentication":
return Optional.ofNullable(clazz.cast(clientAuthentication()));
case "EncryptionInfo":
return Optional.ofNullable(clazz.cast(encryptionInfo()));
case "ConnectivityInfo":
return Optional.ofNullable(clazz.cast(connectivityInfo()));
case "StorageMode":
return Optional.ofNullable(clazz.cast(storageModeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function