software.amazon.awssdk.services.firehose.model.MSKSourceConfiguration Maven / Gradle / Ivy
Show all versions of firehose 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.firehose.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* The configuration for the Amazon MSK cluster to be used as the source for a delivery stream.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class MSKSourceConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField MSK_CLUSTER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MSKClusterARN").getter(getter(MSKSourceConfiguration::mskClusterARN))
.setter(setter(Builder::mskClusterARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MSKClusterARN").build()).build();
private static final SdkField TOPIC_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TopicName").getter(getter(MSKSourceConfiguration::topicName)).setter(setter(Builder::topicName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TopicName").build()).build();
private static final SdkField AUTHENTICATION_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("AuthenticationConfiguration")
.getter(getter(MSKSourceConfiguration::authenticationConfiguration))
.setter(setter(Builder::authenticationConfiguration))
.constructor(AuthenticationConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthenticationConfiguration")
.build()).build();
private static final SdkField READ_FROM_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("ReadFromTimestamp").getter(getter(MSKSourceConfiguration::readFromTimestamp))
.setter(setter(Builder::readFromTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReadFromTimestamp").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MSK_CLUSTER_ARN_FIELD,
TOPIC_NAME_FIELD, AUTHENTICATION_CONFIGURATION_FIELD, READ_FROM_TIMESTAMP_FIELD));
private static final long serialVersionUID = 1L;
private final String mskClusterARN;
private final String topicName;
private final AuthenticationConfiguration authenticationConfiguration;
private final Instant readFromTimestamp;
private MSKSourceConfiguration(BuilderImpl builder) {
this.mskClusterARN = builder.mskClusterARN;
this.topicName = builder.topicName;
this.authenticationConfiguration = builder.authenticationConfiguration;
this.readFromTimestamp = builder.readFromTimestamp;
}
/**
*
* The ARN of the Amazon MSK cluster.
*
*
* @return The ARN of the Amazon MSK cluster.
*/
public final String mskClusterARN() {
return mskClusterARN;
}
/**
*
* The topic name within the Amazon MSK cluster.
*
*
* @return The topic name within the Amazon MSK cluster.
*/
public final String topicName() {
return topicName;
}
/**
*
* The authentication configuration of the Amazon MSK cluster.
*
*
* @return The authentication configuration of the Amazon MSK cluster.
*/
public final AuthenticationConfiguration authenticationConfiguration() {
return authenticationConfiguration;
}
/**
*
* The start date and time in UTC for the offset position within your MSK topic from where Firehose begins to read.
* By default, this is set to timestamp when Firehose becomes Active.
*
*
* If you want to create a Firehose stream with Earliest start position from SDK or CLI, you need to set the
* ReadFromTimestamp
parameter to Epoch (1970-01-01T00:00:00Z).
*
*
* @return The start date and time in UTC for the offset position within your MSK topic from where Firehose begins
* to read. By default, this is set to timestamp when Firehose becomes Active.
*
* If you want to create a Firehose stream with Earliest start position from SDK or CLI, you need to set the
* ReadFromTimestamp
parameter to Epoch (1970-01-01T00:00:00Z).
*/
public final Instant readFromTimestamp() {
return readFromTimestamp;
}
@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(mskClusterARN());
hashCode = 31 * hashCode + Objects.hashCode(topicName());
hashCode = 31 * hashCode + Objects.hashCode(authenticationConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(readFromTimestamp());
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 MSKSourceConfiguration)) {
return false;
}
MSKSourceConfiguration other = (MSKSourceConfiguration) obj;
return Objects.equals(mskClusterARN(), other.mskClusterARN()) && Objects.equals(topicName(), other.topicName())
&& Objects.equals(authenticationConfiguration(), other.authenticationConfiguration())
&& Objects.equals(readFromTimestamp(), other.readFromTimestamp());
}
/**
* 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("MSKSourceConfiguration").add("MSKClusterARN", mskClusterARN()).add("TopicName", topicName())
.add("AuthenticationConfiguration", authenticationConfiguration()).add("ReadFromTimestamp", readFromTimestamp())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "MSKClusterARN":
return Optional.ofNullable(clazz.cast(mskClusterARN()));
case "TopicName":
return Optional.ofNullable(clazz.cast(topicName()));
case "AuthenticationConfiguration":
return Optional.ofNullable(clazz.cast(authenticationConfiguration()));
case "ReadFromTimestamp":
return Optional.ofNullable(clazz.cast(readFromTimestamp()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function