
software.amazon.awssdk.services.kafka.model.CreateClusterRequest Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.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.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateClusterRequest extends KafkaRequest implements
ToCopyableBuilder {
private static final SdkField BROKER_NODE_GROUP_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(CreateClusterRequest::brokerNodeGroupInfo))
.setter(setter(Builder::brokerNodeGroupInfo)).constructor(BrokerNodeGroupInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("brokerNodeGroupInfo").build())
.build();
private static final SdkField CLUSTER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateClusterRequest::clusterName)).setter(setter(Builder::clusterName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clusterName").build()).build();
private static final SdkField ENCRYPTION_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(CreateClusterRequest::encryptionInfo))
.setter(setter(Builder::encryptionInfo)).constructor(EncryptionInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("encryptionInfo").build()).build();
private static final SdkField ENHANCED_MONITORING_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateClusterRequest::enhancedMonitoringAsString)).setter(setter(Builder::enhancedMonitoring))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("enhancedMonitoring").build())
.build();
private static final SdkField KAFKA_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateClusterRequest::kafkaVersion)).setter(setter(Builder::kafkaVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kafkaVersion").build()).build();
private static final SdkField NUMBER_OF_BROKER_NODES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(CreateClusterRequest::numberOfBrokerNodes)).setter(setter(Builder::numberOfBrokerNodes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("numberOfBrokerNodes").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BROKER_NODE_GROUP_INFO_FIELD,
CLUSTER_NAME_FIELD, ENCRYPTION_INFO_FIELD, ENHANCED_MONITORING_FIELD, KAFKA_VERSION_FIELD,
NUMBER_OF_BROKER_NODES_FIELD));
private final BrokerNodeGroupInfo brokerNodeGroupInfo;
private final String clusterName;
private final EncryptionInfo encryptionInfo;
private final String enhancedMonitoring;
private final String kafkaVersion;
private final Integer numberOfBrokerNodes;
private CreateClusterRequest(BuilderImpl builder) {
super(builder);
this.brokerNodeGroupInfo = builder.brokerNodeGroupInfo;
this.clusterName = builder.clusterName;
this.encryptionInfo = builder.encryptionInfo;
this.enhancedMonitoring = builder.enhancedMonitoring;
this.kafkaVersion = builder.kafkaVersion;
this.numberOfBrokerNodes = builder.numberOfBrokerNodes;
}
/**
*
* Information about the broker nodes in the cluster.
*
*
* @return Information about the broker nodes in the cluster.
*/
public BrokerNodeGroupInfo brokerNodeGroupInfo() {
return brokerNodeGroupInfo;
}
/**
*
* The name of the cluster.
*
*
* @return The name of the cluster.
*/
public String clusterName() {
return clusterName;
}
/**
*
* Includes all encryption-related information.
*
*
* @return Includes all encryption-related information.
*/
public EncryptionInfo encryptionInfo() {
return encryptionInfo;
}
/**
*
* Specifies the level of monitoring for the MSK cluster. The possible values are DEFAULT, PER_BROKER, and
* PER_TOPIC_PER_BROKER.
*
*
* 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 the level of monitoring for the MSK cluster. The possible values are DEFAULT, PER_BROKER, and
* PER_TOPIC_PER_BROKER.
* @see EnhancedMonitoring
*/
public EnhancedMonitoring enhancedMonitoring() {
return EnhancedMonitoring.fromValue(enhancedMonitoring);
}
/**
*
* Specifies the level of monitoring for the MSK cluster. The possible values are DEFAULT, PER_BROKER, and
* PER_TOPIC_PER_BROKER.
*
*
* 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 the level of monitoring for the MSK cluster. The possible values are DEFAULT, PER_BROKER, and
* PER_TOPIC_PER_BROKER.
* @see EnhancedMonitoring
*/
public String enhancedMonitoringAsString() {
return enhancedMonitoring;
}
/**
*
* The version of Apache Kafka.
*
*
* @return The version of Apache Kafka.
*/
public String kafkaVersion() {
return kafkaVersion;
}
/**
*
* The number of Kafka broker nodes in the Amazon MSK cluster.
*
*
* @return The number of Kafka broker nodes in the Amazon MSK cluster.
*/
public Integer numberOfBrokerNodes() {
return numberOfBrokerNodes;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(brokerNodeGroupInfo());
hashCode = 31 * hashCode + Objects.hashCode(clusterName());
hashCode = 31 * hashCode + Objects.hashCode(encryptionInfo());
hashCode = 31 * hashCode + Objects.hashCode(enhancedMonitoringAsString());
hashCode = 31 * hashCode + Objects.hashCode(kafkaVersion());
hashCode = 31 * hashCode + Objects.hashCode(numberOfBrokerNodes());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateClusterRequest)) {
return false;
}
CreateClusterRequest other = (CreateClusterRequest) obj;
return Objects.equals(brokerNodeGroupInfo(), other.brokerNodeGroupInfo())
&& Objects.equals(clusterName(), other.clusterName()) && Objects.equals(encryptionInfo(), other.encryptionInfo())
&& Objects.equals(enhancedMonitoringAsString(), other.enhancedMonitoringAsString())
&& Objects.equals(kafkaVersion(), other.kafkaVersion())
&& Objects.equals(numberOfBrokerNodes(), other.numberOfBrokerNodes());
}
/**
* 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("CreateClusterRequest").add("BrokerNodeGroupInfo", brokerNodeGroupInfo())
.add("ClusterName", clusterName()).add("EncryptionInfo", encryptionInfo())
.add("EnhancedMonitoring", enhancedMonitoringAsString()).add("KafkaVersion", kafkaVersion())
.add("NumberOfBrokerNodes", numberOfBrokerNodes()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BrokerNodeGroupInfo":
return Optional.ofNullable(clazz.cast(brokerNodeGroupInfo()));
case "ClusterName":
return Optional.ofNullable(clazz.cast(clusterName()));
case "EncryptionInfo":
return Optional.ofNullable(clazz.cast(encryptionInfo()));
case "EnhancedMonitoring":
return Optional.ofNullable(clazz.cast(enhancedMonitoringAsString()));
case "KafkaVersion":
return Optional.ofNullable(clazz.cast(kafkaVersion()));
case "NumberOfBrokerNodes":
return Optional.ofNullable(clazz.cast(numberOfBrokerNodes()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function