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

software.amazon.awssdk.services.kafka.model.TopicReplicationUpdate 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.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.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.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;

/**
 * 

* Details for updating the topic replication of a replicator. *

*/ @Generated("software.amazon.awssdk:codegen") public final class TopicReplicationUpdate implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField COPY_ACCESS_CONTROL_LISTS_FOR_TOPICS_FIELD = SdkField . builder(MarshallingType.BOOLEAN) .memberName("CopyAccessControlListsForTopics") .getter(getter(TopicReplicationUpdate::copyAccessControlListsForTopics)) .setter(setter(Builder::copyAccessControlListsForTopics)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("copyAccessControlListsForTopics") .build()).build(); private static final SdkField COPY_TOPIC_CONFIGURATIONS_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("CopyTopicConfigurations").getter(getter(TopicReplicationUpdate::copyTopicConfigurations)) .setter(setter(Builder::copyTopicConfigurations)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("copyTopicConfigurations").build()) .build(); private static final SdkField DETECT_AND_COPY_NEW_TOPICS_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("DetectAndCopyNewTopics").getter(getter(TopicReplicationUpdate::detectAndCopyNewTopics)) .setter(setter(Builder::detectAndCopyNewTopics)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("detectAndCopyNewTopics").build()) .build(); private static final SdkField> TOPICS_TO_EXCLUDE_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("TopicsToExclude") .getter(getter(TopicReplicationUpdate::topicsToExclude)) .setter(setter(Builder::topicsToExclude)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("topicsToExclude").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> TOPICS_TO_REPLICATE_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("TopicsToReplicate") .getter(getter(TopicReplicationUpdate::topicsToReplicate)) .setter(setter(Builder::topicsToReplicate)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("topicsToReplicate").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList( COPY_ACCESS_CONTROL_LISTS_FOR_TOPICS_FIELD, COPY_TOPIC_CONFIGURATIONS_FIELD, DETECT_AND_COPY_NEW_TOPICS_FIELD, TOPICS_TO_EXCLUDE_FIELD, TOPICS_TO_REPLICATE_FIELD)); private static final long serialVersionUID = 1L; private final Boolean copyAccessControlListsForTopics; private final Boolean copyTopicConfigurations; private final Boolean detectAndCopyNewTopics; private final List topicsToExclude; private final List topicsToReplicate; private TopicReplicationUpdate(BuilderImpl builder) { this.copyAccessControlListsForTopics = builder.copyAccessControlListsForTopics; this.copyTopicConfigurations = builder.copyTopicConfigurations; this.detectAndCopyNewTopics = builder.detectAndCopyNewTopics; this.topicsToExclude = builder.topicsToExclude; this.topicsToReplicate = builder.topicsToReplicate; } /** *

* Whether to periodically configure remote topic ACLs to match their corresponding upstream topics. *

* * @return Whether to periodically configure remote topic ACLs to match their corresponding upstream topics. */ public final Boolean copyAccessControlListsForTopics() { return copyAccessControlListsForTopics; } /** *

* Whether to periodically configure remote topics to match their corresponding upstream topics. *

* * @return Whether to periodically configure remote topics to match their corresponding upstream topics. */ public final Boolean copyTopicConfigurations() { return copyTopicConfigurations; } /** *

* Whether to periodically check for new topics and partitions. *

* * @return Whether to periodically check for new topics and partitions. */ public final Boolean detectAndCopyNewTopics() { return detectAndCopyNewTopics; } /** * For responses, this returns true if the service returned a value for the TopicsToExclude 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 hasTopicsToExclude() { return topicsToExclude != null && !(topicsToExclude instanceof SdkAutoConstructList); } /** *

* List of regular expression patterns indicating the topics that should not be replicated. *

*

* 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 #hasTopicsToExclude} method. *

* * @return List of regular expression patterns indicating the topics that should not be replicated. */ public final List topicsToExclude() { return topicsToExclude; } /** * For responses, this returns true if the service returned a value for the TopicsToReplicate 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 hasTopicsToReplicate() { return topicsToReplicate != null && !(topicsToReplicate instanceof SdkAutoConstructList); } /** *

* List of regular expression patterns indicating the topics to copy. *

*

* 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 #hasTopicsToReplicate} method. *

* * @return List of regular expression patterns indicating the topics to copy. */ public final List topicsToReplicate() { return topicsToReplicate; } @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(copyAccessControlListsForTopics()); hashCode = 31 * hashCode + Objects.hashCode(copyTopicConfigurations()); hashCode = 31 * hashCode + Objects.hashCode(detectAndCopyNewTopics()); hashCode = 31 * hashCode + Objects.hashCode(hasTopicsToExclude() ? topicsToExclude() : null); hashCode = 31 * hashCode + Objects.hashCode(hasTopicsToReplicate() ? topicsToReplicate() : null); 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 TopicReplicationUpdate)) { return false; } TopicReplicationUpdate other = (TopicReplicationUpdate) obj; return Objects.equals(copyAccessControlListsForTopics(), other.copyAccessControlListsForTopics()) && Objects.equals(copyTopicConfigurations(), other.copyTopicConfigurations()) && Objects.equals(detectAndCopyNewTopics(), other.detectAndCopyNewTopics()) && hasTopicsToExclude() == other.hasTopicsToExclude() && Objects.equals(topicsToExclude(), other.topicsToExclude()) && hasTopicsToReplicate() == other.hasTopicsToReplicate() && Objects.equals(topicsToReplicate(), other.topicsToReplicate()); } /** * 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("TopicReplicationUpdate") .add("CopyAccessControlListsForTopics", copyAccessControlListsForTopics()) .add("CopyTopicConfigurations", copyTopicConfigurations()) .add("DetectAndCopyNewTopics", detectAndCopyNewTopics()) .add("TopicsToExclude", hasTopicsToExclude() ? topicsToExclude() : null) .add("TopicsToReplicate", hasTopicsToReplicate() ? topicsToReplicate() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "CopyAccessControlListsForTopics": return Optional.ofNullable(clazz.cast(copyAccessControlListsForTopics())); case "CopyTopicConfigurations": return Optional.ofNullable(clazz.cast(copyTopicConfigurations())); case "DetectAndCopyNewTopics": return Optional.ofNullable(clazz.cast(detectAndCopyNewTopics())); case "TopicsToExclude": return Optional.ofNullable(clazz.cast(topicsToExclude())); case "TopicsToReplicate": return Optional.ofNullable(clazz.cast(topicsToReplicate())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((TopicReplicationUpdate) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Whether to periodically configure remote topic ACLs to match their corresponding upstream topics. *

* * @param copyAccessControlListsForTopics * Whether to periodically configure remote topic ACLs to match their corresponding upstream topics. * @return Returns a reference to this object so that method calls can be chained together. */ Builder copyAccessControlListsForTopics(Boolean copyAccessControlListsForTopics); /** *

* Whether to periodically configure remote topics to match their corresponding upstream topics. *

* * @param copyTopicConfigurations * Whether to periodically configure remote topics to match their corresponding upstream topics. * @return Returns a reference to this object so that method calls can be chained together. */ Builder copyTopicConfigurations(Boolean copyTopicConfigurations); /** *

* Whether to periodically check for new topics and partitions. *

* * @param detectAndCopyNewTopics * Whether to periodically check for new topics and partitions. * @return Returns a reference to this object so that method calls can be chained together. */ Builder detectAndCopyNewTopics(Boolean detectAndCopyNewTopics); /** *

* List of regular expression patterns indicating the topics that should not be replicated. *

* * @param topicsToExclude * List of regular expression patterns indicating the topics that should not be replicated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder topicsToExclude(Collection topicsToExclude); /** *

* List of regular expression patterns indicating the topics that should not be replicated. *

* * @param topicsToExclude * List of regular expression patterns indicating the topics that should not be replicated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder topicsToExclude(String... topicsToExclude); /** *

* List of regular expression patterns indicating the topics to copy. *

* * @param topicsToReplicate * List of regular expression patterns indicating the topics to copy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder topicsToReplicate(Collection topicsToReplicate); /** *

* List of regular expression patterns indicating the topics to copy. *

* * @param topicsToReplicate * List of regular expression patterns indicating the topics to copy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder topicsToReplicate(String... topicsToReplicate); } static final class BuilderImpl implements Builder { private Boolean copyAccessControlListsForTopics; private Boolean copyTopicConfigurations; private Boolean detectAndCopyNewTopics; private List topicsToExclude = DefaultSdkAutoConstructList.getInstance(); private List topicsToReplicate = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(TopicReplicationUpdate model) { copyAccessControlListsForTopics(model.copyAccessControlListsForTopics); copyTopicConfigurations(model.copyTopicConfigurations); detectAndCopyNewTopics(model.detectAndCopyNewTopics); topicsToExclude(model.topicsToExclude); topicsToReplicate(model.topicsToReplicate); } public final Boolean getCopyAccessControlListsForTopics() { return copyAccessControlListsForTopics; } public final void setCopyAccessControlListsForTopics(Boolean copyAccessControlListsForTopics) { this.copyAccessControlListsForTopics = copyAccessControlListsForTopics; } @Override public final Builder copyAccessControlListsForTopics(Boolean copyAccessControlListsForTopics) { this.copyAccessControlListsForTopics = copyAccessControlListsForTopics; return this; } public final Boolean getCopyTopicConfigurations() { return copyTopicConfigurations; } public final void setCopyTopicConfigurations(Boolean copyTopicConfigurations) { this.copyTopicConfigurations = copyTopicConfigurations; } @Override public final Builder copyTopicConfigurations(Boolean copyTopicConfigurations) { this.copyTopicConfigurations = copyTopicConfigurations; return this; } public final Boolean getDetectAndCopyNewTopics() { return detectAndCopyNewTopics; } public final void setDetectAndCopyNewTopics(Boolean detectAndCopyNewTopics) { this.detectAndCopyNewTopics = detectAndCopyNewTopics; } @Override public final Builder detectAndCopyNewTopics(Boolean detectAndCopyNewTopics) { this.detectAndCopyNewTopics = detectAndCopyNewTopics; return this; } public final Collection getTopicsToExclude() { if (topicsToExclude instanceof SdkAutoConstructList) { return null; } return topicsToExclude; } public final void setTopicsToExclude(Collection topicsToExclude) { this.topicsToExclude = ___listOf__stringMax249Copier.copy(topicsToExclude); } @Override public final Builder topicsToExclude(Collection topicsToExclude) { this.topicsToExclude = ___listOf__stringMax249Copier.copy(topicsToExclude); return this; } @Override @SafeVarargs public final Builder topicsToExclude(String... topicsToExclude) { topicsToExclude(Arrays.asList(topicsToExclude)); return this; } public final Collection getTopicsToReplicate() { if (topicsToReplicate instanceof SdkAutoConstructList) { return null; } return topicsToReplicate; } public final void setTopicsToReplicate(Collection topicsToReplicate) { this.topicsToReplicate = ___listOf__stringMax249Copier.copy(topicsToReplicate); } @Override public final Builder topicsToReplicate(Collection topicsToReplicate) { this.topicsToReplicate = ___listOf__stringMax249Copier.copy(topicsToReplicate); return this; } @Override @SafeVarargs public final Builder topicsToReplicate(String... topicsToReplicate) { topicsToReplicate(Arrays.asList(topicsToReplicate)); return this; } @Override public TopicReplicationUpdate build() { return new TopicReplicationUpdate(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy