software.amazon.awssdk.services.kafka.model.ReplicationInfo Maven / Gradle / Ivy
Show all versions of kafka Show documentation
/*
* 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 extends Builder> 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