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

software.amazon.awssdk.services.kinesis.model.ConsumerDescription Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Kinesis module holds the client classes that are used for communicating with Amazon Kinesis Service

There is a newer version: 2.29.19
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.kinesis.model;

import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* An object that represents the details of a registered consumer. This type of object is returned by * DescribeStreamConsumer. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ConsumerDescription implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CONSUMER_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ConsumerName").getter(getter(ConsumerDescription::consumerName)).setter(setter(Builder::consumerName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConsumerName").build()).build(); private static final SdkField CONSUMER_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ConsumerARN").getter(getter(ConsumerDescription::consumerARN)).setter(setter(Builder::consumerARN)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConsumerARN").build()).build(); private static final SdkField CONSUMER_STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ConsumerStatus").getter(getter(ConsumerDescription::consumerStatusAsString)) .setter(setter(Builder::consumerStatus)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConsumerStatus").build()).build(); private static final SdkField CONSUMER_CREATION_TIMESTAMP_FIELD = SdkField . builder(MarshallingType.INSTANT).memberName("ConsumerCreationTimestamp") .getter(getter(ConsumerDescription::consumerCreationTimestamp)).setter(setter(Builder::consumerCreationTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConsumerCreationTimestamp").build()) .build(); private static final SdkField STREAM_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("StreamARN").getter(getter(ConsumerDescription::streamARN)).setter(setter(Builder::streamARN)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StreamARN").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CONSUMER_NAME_FIELD, CONSUMER_ARN_FIELD, CONSUMER_STATUS_FIELD, CONSUMER_CREATION_TIMESTAMP_FIELD, STREAM_ARN_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("ConsumerName", CONSUMER_NAME_FIELD); put("ConsumerARN", CONSUMER_ARN_FIELD); put("ConsumerStatus", CONSUMER_STATUS_FIELD); put("ConsumerCreationTimestamp", CONSUMER_CREATION_TIMESTAMP_FIELD); put("StreamARN", STREAM_ARN_FIELD); } }); private static final long serialVersionUID = 1L; private final String consumerName; private final String consumerARN; private final String consumerStatus; private final Instant consumerCreationTimestamp; private final String streamARN; private ConsumerDescription(BuilderImpl builder) { this.consumerName = builder.consumerName; this.consumerARN = builder.consumerARN; this.consumerStatus = builder.consumerStatus; this.consumerCreationTimestamp = builder.consumerCreationTimestamp; this.streamARN = builder.streamARN; } /** *

* The name of the consumer is something you choose when you register the consumer. *

* * @return The name of the consumer is something you choose when you register the consumer. */ public final String consumerName() { return consumerName; } /** *

* When you register a consumer, Kinesis Data Streams generates an ARN for it. You need this ARN to be able to call * SubscribeToShard. *

*

* If you delete a consumer and then create a new one with the same name, it won't have the same ARN. That's because * consumer ARNs contain the creation timestamp. This is important to keep in mind if you have IAM policies that * reference consumer ARNs. *

* * @return When you register a consumer, Kinesis Data Streams generates an ARN for it. You need this ARN to be able * to call SubscribeToShard.

*

* If you delete a consumer and then create a new one with the same name, it won't have the same ARN. That's * because consumer ARNs contain the creation timestamp. This is important to keep in mind if you have IAM * policies that reference consumer ARNs. */ public final String consumerARN() { return consumerARN; } /** *

* A consumer can't read data while in the CREATING or DELETING states. *

*

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

* * @return A consumer can't read data while in the CREATING or DELETING states. * @see ConsumerStatus */ public final ConsumerStatus consumerStatus() { return ConsumerStatus.fromValue(consumerStatus); } /** *

* A consumer can't read data while in the CREATING or DELETING states. *

*

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

* * @return A consumer can't read data while in the CREATING or DELETING states. * @see ConsumerStatus */ public final String consumerStatusAsString() { return consumerStatus; } /** *

* * @return */ public final Instant consumerCreationTimestamp() { return consumerCreationTimestamp; } /** *

* The ARN of the stream with which you registered the consumer. *

* * @return The ARN of the stream with which you registered the consumer. */ public final String streamARN() { return streamARN; } @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(consumerName()); hashCode = 31 * hashCode + Objects.hashCode(consumerARN()); hashCode = 31 * hashCode + Objects.hashCode(consumerStatusAsString()); hashCode = 31 * hashCode + Objects.hashCode(consumerCreationTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(streamARN()); 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 ConsumerDescription)) { return false; } ConsumerDescription other = (ConsumerDescription) obj; return Objects.equals(consumerName(), other.consumerName()) && Objects.equals(consumerARN(), other.consumerARN()) && Objects.equals(consumerStatusAsString(), other.consumerStatusAsString()) && Objects.equals(consumerCreationTimestamp(), other.consumerCreationTimestamp()) && Objects.equals(streamARN(), other.streamARN()); } /** * 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("ConsumerDescription").add("ConsumerName", consumerName()).add("ConsumerARN", consumerARN()) .add("ConsumerStatus", consumerStatusAsString()).add("ConsumerCreationTimestamp", consumerCreationTimestamp()) .add("StreamARN", streamARN()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ConsumerName": return Optional.ofNullable(clazz.cast(consumerName())); case "ConsumerARN": return Optional.ofNullable(clazz.cast(consumerARN())); case "ConsumerStatus": return Optional.ofNullable(clazz.cast(consumerStatusAsString())); case "ConsumerCreationTimestamp": return Optional.ofNullable(clazz.cast(consumerCreationTimestamp())); case "StreamARN": return Optional.ofNullable(clazz.cast(streamARN())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((ConsumerDescription) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the consumer is something you choose when you register the consumer. *

* * @param consumerName * The name of the consumer is something you choose when you register the consumer. * @return Returns a reference to this object so that method calls can be chained together. */ Builder consumerName(String consumerName); /** *

* When you register a consumer, Kinesis Data Streams generates an ARN for it. You need this ARN to be able to * call SubscribeToShard. *

*

* If you delete a consumer and then create a new one with the same name, it won't have the same ARN. That's * because consumer ARNs contain the creation timestamp. This is important to keep in mind if you have IAM * policies that reference consumer ARNs. *

* * @param consumerARN * When you register a consumer, Kinesis Data Streams generates an ARN for it. You need this ARN to be * able to call SubscribeToShard.

*

* If you delete a consumer and then create a new one with the same name, it won't have the same ARN. * That's because consumer ARNs contain the creation timestamp. This is important to keep in mind if you * have IAM policies that reference consumer ARNs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder consumerARN(String consumerARN); /** *

* A consumer can't read data while in the CREATING or DELETING states. *

* * @param consumerStatus * A consumer can't read data while in the CREATING or DELETING states. * @see ConsumerStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ConsumerStatus */ Builder consumerStatus(String consumerStatus); /** *

* A consumer can't read data while in the CREATING or DELETING states. *

* * @param consumerStatus * A consumer can't read data while in the CREATING or DELETING states. * @see ConsumerStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ConsumerStatus */ Builder consumerStatus(ConsumerStatus consumerStatus); /** *

* * @param consumerCreationTimestamp * @return Returns a reference to this object so that method calls can be chained together. */ Builder consumerCreationTimestamp(Instant consumerCreationTimestamp); /** *

* The ARN of the stream with which you registered the consumer. *

* * @param streamARN * The ARN of the stream with which you registered the consumer. * @return Returns a reference to this object so that method calls can be chained together. */ Builder streamARN(String streamARN); } static final class BuilderImpl implements Builder { private String consumerName; private String consumerARN; private String consumerStatus; private Instant consumerCreationTimestamp; private String streamARN; private BuilderImpl() { } private BuilderImpl(ConsumerDescription model) { consumerName(model.consumerName); consumerARN(model.consumerARN); consumerStatus(model.consumerStatus); consumerCreationTimestamp(model.consumerCreationTimestamp); streamARN(model.streamARN); } public final String getConsumerName() { return consumerName; } public final void setConsumerName(String consumerName) { this.consumerName = consumerName; } @Override public final Builder consumerName(String consumerName) { this.consumerName = consumerName; return this; } public final String getConsumerARN() { return consumerARN; } public final void setConsumerARN(String consumerARN) { this.consumerARN = consumerARN; } @Override public final Builder consumerARN(String consumerARN) { this.consumerARN = consumerARN; return this; } public final String getConsumerStatus() { return consumerStatus; } public final void setConsumerStatus(String consumerStatus) { this.consumerStatus = consumerStatus; } @Override public final Builder consumerStatus(String consumerStatus) { this.consumerStatus = consumerStatus; return this; } @Override public final Builder consumerStatus(ConsumerStatus consumerStatus) { this.consumerStatus(consumerStatus == null ? null : consumerStatus.toString()); return this; } public final Instant getConsumerCreationTimestamp() { return consumerCreationTimestamp; } public final void setConsumerCreationTimestamp(Instant consumerCreationTimestamp) { this.consumerCreationTimestamp = consumerCreationTimestamp; } @Override public final Builder consumerCreationTimestamp(Instant consumerCreationTimestamp) { this.consumerCreationTimestamp = consumerCreationTimestamp; return this; } public final String getStreamARN() { return streamARN; } public final void setStreamARN(String streamARN) { this.streamARN = streamARN; } @Override public final Builder streamARN(String streamARN) { this.streamARN = streamARN; return this; } @Override public ConsumerDescription build() { return new ConsumerDescription(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy