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

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 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 getter(Function g) { return obj -> g.apply((CreateClusterRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends KafkaRequest.Builder, SdkPojo, CopyableBuilder { /** *

* Information about the broker nodes in the cluster. *

* * @param brokerNodeGroupInfo * Information about the broker nodes in the cluster. * @return Returns a reference to this object so that method calls can be chained together. */ Builder brokerNodeGroupInfo(BrokerNodeGroupInfo brokerNodeGroupInfo); /** *

* Information about the broker nodes in the cluster. *

* This is a convenience that creates an instance of the {@link BrokerNodeGroupInfo.Builder} avoiding the need * to create one manually via {@link BrokerNodeGroupInfo#builder()}. * * When the {@link Consumer} completes, {@link BrokerNodeGroupInfo.Builder#build()} is called immediately and * its result is passed to {@link #brokerNodeGroupInfo(BrokerNodeGroupInfo)}. * * @param brokerNodeGroupInfo * a consumer that will call methods on {@link BrokerNodeGroupInfo.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #brokerNodeGroupInfo(BrokerNodeGroupInfo) */ default Builder brokerNodeGroupInfo(Consumer brokerNodeGroupInfo) { return brokerNodeGroupInfo(BrokerNodeGroupInfo.builder().applyMutation(brokerNodeGroupInfo).build()); } /** *

* The name of the cluster. *

* * @param clusterName * The name of the cluster. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clusterName(String clusterName); /** *

* Includes all encryption-related information. *

* * @param encryptionInfo * Includes all encryption-related information. * @return Returns a reference to this object so that method calls can be chained together. */ Builder encryptionInfo(EncryptionInfo encryptionInfo); /** *

* Includes all encryption-related information. *

* This is a convenience that creates an instance of the {@link EncryptionInfo.Builder} avoiding the need to * create one manually via {@link EncryptionInfo#builder()}. * * When the {@link Consumer} completes, {@link EncryptionInfo.Builder#build()} is called immediately and its * result is passed to {@link #encryptionInfo(EncryptionInfo)}. * * @param encryptionInfo * a consumer that will call methods on {@link EncryptionInfo.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #encryptionInfo(EncryptionInfo) */ default Builder encryptionInfo(Consumer encryptionInfo) { return encryptionInfo(EncryptionInfo.builder().applyMutation(encryptionInfo).build()); } /** *

* Specifies the level of monitoring for the MSK cluster. The possible values are DEFAULT, PER_BROKER, and * PER_TOPIC_PER_BROKER. *

* * @param enhancedMonitoring * Specifies the level of monitoring for the MSK cluster. The possible values are DEFAULT, PER_BROKER, * and PER_TOPIC_PER_BROKER. * @see EnhancedMonitoring * @return Returns a reference to this object so that method calls can be chained together. * @see EnhancedMonitoring */ Builder enhancedMonitoring(String enhancedMonitoring); /** *

* Specifies the level of monitoring for the MSK cluster. The possible values are DEFAULT, PER_BROKER, and * PER_TOPIC_PER_BROKER. *

* * @param enhancedMonitoring * Specifies the level of monitoring for the MSK cluster. The possible values are DEFAULT, PER_BROKER, * and PER_TOPIC_PER_BROKER. * @see EnhancedMonitoring * @return Returns a reference to this object so that method calls can be chained together. * @see EnhancedMonitoring */ Builder enhancedMonitoring(EnhancedMonitoring enhancedMonitoring); /** *

* The version of Apache Kafka. *

* * @param kafkaVersion * The version of Apache Kafka. * @return Returns a reference to this object so that method calls can be chained together. */ Builder kafkaVersion(String kafkaVersion); /** *

* The number of Kafka broker nodes in the Amazon MSK cluster. *

* * @param numberOfBrokerNodes * The number of Kafka broker nodes in the Amazon MSK cluster. * @return Returns a reference to this object so that method calls can be chained together. */ Builder numberOfBrokerNodes(Integer numberOfBrokerNodes); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends KafkaRequest.BuilderImpl implements Builder { private BrokerNodeGroupInfo brokerNodeGroupInfo; private String clusterName; private EncryptionInfo encryptionInfo; private String enhancedMonitoring; private String kafkaVersion; private Integer numberOfBrokerNodes; private BuilderImpl() { } private BuilderImpl(CreateClusterRequest model) { super(model); brokerNodeGroupInfo(model.brokerNodeGroupInfo); clusterName(model.clusterName); encryptionInfo(model.encryptionInfo); enhancedMonitoring(model.enhancedMonitoring); kafkaVersion(model.kafkaVersion); numberOfBrokerNodes(model.numberOfBrokerNodes); } public final BrokerNodeGroupInfo.Builder getBrokerNodeGroupInfo() { return brokerNodeGroupInfo != null ? brokerNodeGroupInfo.toBuilder() : null; } @Override public final Builder brokerNodeGroupInfo(BrokerNodeGroupInfo brokerNodeGroupInfo) { this.brokerNodeGroupInfo = brokerNodeGroupInfo; return this; } public final void setBrokerNodeGroupInfo(BrokerNodeGroupInfo.BuilderImpl brokerNodeGroupInfo) { this.brokerNodeGroupInfo = brokerNodeGroupInfo != null ? brokerNodeGroupInfo.build() : null; } public final String getClusterName() { return clusterName; } @Override public final Builder clusterName(String clusterName) { this.clusterName = clusterName; return this; } public final void setClusterName(String clusterName) { this.clusterName = clusterName; } public final EncryptionInfo.Builder getEncryptionInfo() { return encryptionInfo != null ? encryptionInfo.toBuilder() : null; } @Override public final Builder encryptionInfo(EncryptionInfo encryptionInfo) { this.encryptionInfo = encryptionInfo; return this; } public final void setEncryptionInfo(EncryptionInfo.BuilderImpl encryptionInfo) { this.encryptionInfo = encryptionInfo != null ? encryptionInfo.build() : null; } public final String getEnhancedMonitoringAsString() { return enhancedMonitoring; } @Override public final Builder enhancedMonitoring(String enhancedMonitoring) { this.enhancedMonitoring = enhancedMonitoring; return this; } @Override public final Builder enhancedMonitoring(EnhancedMonitoring enhancedMonitoring) { this.enhancedMonitoring(enhancedMonitoring.toString()); return this; } public final void setEnhancedMonitoring(String enhancedMonitoring) { this.enhancedMonitoring = enhancedMonitoring; } public final String getKafkaVersion() { return kafkaVersion; } @Override public final Builder kafkaVersion(String kafkaVersion) { this.kafkaVersion = kafkaVersion; return this; } public final void setKafkaVersion(String kafkaVersion) { this.kafkaVersion = kafkaVersion; } public final Integer getNumberOfBrokerNodes() { return numberOfBrokerNodes; } @Override public final Builder numberOfBrokerNodes(Integer numberOfBrokerNodes) { this.numberOfBrokerNodes = numberOfBrokerNodes; return this; } public final void setNumberOfBrokerNodes(Integer numberOfBrokerNodes) { this.numberOfBrokerNodes = numberOfBrokerNodes; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CreateClusterRequest build() { return new CreateClusterRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy