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

software.amazon.awssdk.services.kafka.model.ReplicationInfo Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Kafka module holds the client classes that are used for communicating with Kafka.

There is a newer version: 2.29.15
Show newest version
/*
 * 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.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;

/**
 * 

* Specifies configuration for replication between a source and target Kafka cluster. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ReplicationInfo implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CONSUMER_GROUP_REPLICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ConsumerGroupReplication") .getter(getter(ReplicationInfo::consumerGroupReplication)).setter(setter(Builder::consumerGroupReplication)) .constructor(ConsumerGroupReplication::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("consumerGroupReplication").build()) .build(); private static final SdkField SOURCE_KAFKA_CLUSTER_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SourceKafkaClusterArn").getter(getter(ReplicationInfo::sourceKafkaClusterArn)) .setter(setter(Builder::sourceKafkaClusterArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sourceKafkaClusterArn").build()) .build(); private static final SdkField TARGET_COMPRESSION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TargetCompressionType").getter(getter(ReplicationInfo::targetCompressionTypeAsString)) .setter(setter(Builder::targetCompressionType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetCompressionType").build()) .build(); private static final SdkField TARGET_KAFKA_CLUSTER_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TargetKafkaClusterArn").getter(getter(ReplicationInfo::targetKafkaClusterArn)) .setter(setter(Builder::targetKafkaClusterArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetKafkaClusterArn").build()) .build(); private static final SdkField TOPIC_REPLICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("TopicReplication") .getter(getter(ReplicationInfo::topicReplication)).setter(setter(Builder::topicReplication)) .constructor(TopicReplication::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("topicReplication").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList( CONSUMER_GROUP_REPLICATION_FIELD, SOURCE_KAFKA_CLUSTER_ARN_FIELD, TARGET_COMPRESSION_TYPE_FIELD, TARGET_KAFKA_CLUSTER_ARN_FIELD, TOPIC_REPLICATION_FIELD)); private static final long serialVersionUID = 1L; private final ConsumerGroupReplication consumerGroupReplication; private final String sourceKafkaClusterArn; private final String targetCompressionType; private final String targetKafkaClusterArn; private final TopicReplication topicReplication; private ReplicationInfo(BuilderImpl builder) { this.consumerGroupReplication = builder.consumerGroupReplication; this.sourceKafkaClusterArn = builder.sourceKafkaClusterArn; this.targetCompressionType = builder.targetCompressionType; this.targetKafkaClusterArn = builder.targetKafkaClusterArn; this.topicReplication = builder.topicReplication; } /** *

* Configuration relating to consumer group replication. *

* * @return Configuration relating to consumer group replication. */ public final ConsumerGroupReplication consumerGroupReplication() { return consumerGroupReplication; } /** *

* The ARN of the source Kafka cluster. *

* * @return The ARN of the source Kafka cluster. */ public final String sourceKafkaClusterArn() { return sourceKafkaClusterArn; } /** *

* The compression type to use when producing records to target cluster. *

*

* If the service returns an enum value that is not available in the current SDK version, * {@link #targetCompressionType} will return {@link TargetCompressionType#UNKNOWN_TO_SDK_VERSION}. The raw value * returned by the service is available from {@link #targetCompressionTypeAsString}. *

* * @return The compression type to use when producing records to target cluster. * @see TargetCompressionType */ public final TargetCompressionType targetCompressionType() { return TargetCompressionType.fromValue(targetCompressionType); } /** *

* The compression type to use when producing records to target cluster. *

*

* If the service returns an enum value that is not available in the current SDK version, * {@link #targetCompressionType} will return {@link TargetCompressionType#UNKNOWN_TO_SDK_VERSION}. The raw value * returned by the service is available from {@link #targetCompressionTypeAsString}. *

* * @return The compression type to use when producing records to target cluster. * @see TargetCompressionType */ public final String targetCompressionTypeAsString() { return targetCompressionType; } /** *

* The ARN of the target Kafka cluster. *

* * @return The ARN of the target Kafka cluster. */ public final String targetKafkaClusterArn() { return targetKafkaClusterArn; } /** *

* Configuration relating to topic replication. *

* * @return Configuration relating to topic replication. */ public final TopicReplication topicReplication() { return topicReplication; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(consumerGroupReplication()); hashCode = 31 * hashCode + Objects.hashCode(sourceKafkaClusterArn()); hashCode = 31 * hashCode + Objects.hashCode(targetCompressionTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(targetKafkaClusterArn()); hashCode = 31 * hashCode + Objects.hashCode(topicReplication()); 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 ReplicationInfo)) { return false; } ReplicationInfo other = (ReplicationInfo) obj; return Objects.equals(consumerGroupReplication(), other.consumerGroupReplication()) && Objects.equals(sourceKafkaClusterArn(), other.sourceKafkaClusterArn()) && Objects.equals(targetCompressionTypeAsString(), other.targetCompressionTypeAsString()) && Objects.equals(targetKafkaClusterArn(), other.targetKafkaClusterArn()) && Objects.equals(topicReplication(), other.topicReplication()); } /** * 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("ReplicationInfo").add("ConsumerGroupReplication", consumerGroupReplication()) .add("SourceKafkaClusterArn", sourceKafkaClusterArn()) .add("TargetCompressionType", targetCompressionTypeAsString()) .add("TargetKafkaClusterArn", targetKafkaClusterArn()).add("TopicReplication", topicReplication()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ConsumerGroupReplication": return Optional.ofNullable(clazz.cast(consumerGroupReplication())); case "SourceKafkaClusterArn": return Optional.ofNullable(clazz.cast(sourceKafkaClusterArn())); case "TargetCompressionType": return Optional.ofNullable(clazz.cast(targetCompressionTypeAsString())); case "TargetKafkaClusterArn": return Optional.ofNullable(clazz.cast(targetKafkaClusterArn())); case "TopicReplication": return Optional.ofNullable(clazz.cast(topicReplication())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ReplicationInfo) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Configuration relating to consumer group replication. *

* * @param consumerGroupReplication * Configuration relating to consumer group replication. * @return Returns a reference to this object so that method calls can be chained together. */ Builder consumerGroupReplication(ConsumerGroupReplication consumerGroupReplication); /** *

* Configuration relating to consumer group replication. *

* This is a convenience method that creates an instance of the {@link ConsumerGroupReplication.Builder} * avoiding the need to create one manually via {@link ConsumerGroupReplication#builder()}. * *

* When the {@link Consumer} completes, {@link ConsumerGroupReplication.Builder#build()} is called immediately * and its result is passed to {@link #consumerGroupReplication(ConsumerGroupReplication)}. * * @param consumerGroupReplication * a consumer that will call methods on {@link ConsumerGroupReplication.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #consumerGroupReplication(ConsumerGroupReplication) */ default Builder consumerGroupReplication(Consumer consumerGroupReplication) { return consumerGroupReplication(ConsumerGroupReplication.builder().applyMutation(consumerGroupReplication).build()); } /** *

* The ARN of the source Kafka cluster. *

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

* The compression type to use when producing records to target cluster. *

* * @param targetCompressionType * The compression type to use when producing records to target cluster. * @see TargetCompressionType * @return Returns a reference to this object so that method calls can be chained together. * @see TargetCompressionType */ Builder targetCompressionType(String targetCompressionType); /** *

* The compression type to use when producing records to target cluster. *

* * @param targetCompressionType * The compression type to use when producing records to target cluster. * @see TargetCompressionType * @return Returns a reference to this object so that method calls can be chained together. * @see TargetCompressionType */ Builder targetCompressionType(TargetCompressionType targetCompressionType); /** *

* The ARN of the target Kafka cluster. *

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

* Configuration relating to topic replication. *

* * @param topicReplication * Configuration relating to topic replication. * @return Returns a reference to this object so that method calls can be chained together. */ Builder topicReplication(TopicReplication topicReplication); /** *

* Configuration relating to topic replication. *

* This is a convenience method that creates an instance of the {@link TopicReplication.Builder} avoiding the * need to create one manually via {@link TopicReplication#builder()}. * *

* When the {@link Consumer} completes, {@link TopicReplication.Builder#build()} is called immediately and its * result is passed to {@link #topicReplication(TopicReplication)}. * * @param topicReplication * a consumer that will call methods on {@link TopicReplication.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #topicReplication(TopicReplication) */ default Builder topicReplication(Consumer topicReplication) { return topicReplication(TopicReplication.builder().applyMutation(topicReplication).build()); } } static final class BuilderImpl implements Builder { private ConsumerGroupReplication consumerGroupReplication; private String sourceKafkaClusterArn; private String targetCompressionType; private String targetKafkaClusterArn; private TopicReplication topicReplication; private BuilderImpl() { } private BuilderImpl(ReplicationInfo model) { consumerGroupReplication(model.consumerGroupReplication); sourceKafkaClusterArn(model.sourceKafkaClusterArn); targetCompressionType(model.targetCompressionType); targetKafkaClusterArn(model.targetKafkaClusterArn); topicReplication(model.topicReplication); } public final ConsumerGroupReplication.Builder getConsumerGroupReplication() { return consumerGroupReplication != null ? consumerGroupReplication.toBuilder() : null; } public final void setConsumerGroupReplication(ConsumerGroupReplication.BuilderImpl consumerGroupReplication) { this.consumerGroupReplication = consumerGroupReplication != null ? consumerGroupReplication.build() : null; } @Override public final Builder consumerGroupReplication(ConsumerGroupReplication consumerGroupReplication) { this.consumerGroupReplication = consumerGroupReplication; return this; } public final String getSourceKafkaClusterArn() { return sourceKafkaClusterArn; } public final void setSourceKafkaClusterArn(String sourceKafkaClusterArn) { this.sourceKafkaClusterArn = sourceKafkaClusterArn; } @Override public final Builder sourceKafkaClusterArn(String sourceKafkaClusterArn) { this.sourceKafkaClusterArn = sourceKafkaClusterArn; return this; } public final String getTargetCompressionType() { return targetCompressionType; } public final void setTargetCompressionType(String targetCompressionType) { this.targetCompressionType = targetCompressionType; } @Override public final Builder targetCompressionType(String targetCompressionType) { this.targetCompressionType = targetCompressionType; return this; } @Override public final Builder targetCompressionType(TargetCompressionType targetCompressionType) { this.targetCompressionType(targetCompressionType == null ? null : targetCompressionType.toString()); return this; } public final String getTargetKafkaClusterArn() { return targetKafkaClusterArn; } public final void setTargetKafkaClusterArn(String targetKafkaClusterArn) { this.targetKafkaClusterArn = targetKafkaClusterArn; } @Override public final Builder targetKafkaClusterArn(String targetKafkaClusterArn) { this.targetKafkaClusterArn = targetKafkaClusterArn; return this; } public final TopicReplication.Builder getTopicReplication() { return topicReplication != null ? topicReplication.toBuilder() : null; } public final void setTopicReplication(TopicReplication.BuilderImpl topicReplication) { this.topicReplication = topicReplication != null ? topicReplication.build() : null; } @Override public final Builder topicReplication(TopicReplication topicReplication) { this.topicReplication = topicReplication; return this; } @Override public ReplicationInfo build() { return new ReplicationInfo(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy