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

A single bundled dependency that includes all service and dependent JARs with third-party libraries relocated to different namespaces.

There is a newer version: 2.5.20
Show newest version
/*
 * Copyright 2013-2018 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.time.Instant;
import java.util.Objects;
import java.util.Optional;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.kinesis.transform.ConsumerDescriptionMarshaller;
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. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ConsumerDescription implements StructuredPojo, ToCopyableBuilder { 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 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 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 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 String consumerStatusAsString() { return consumerStatus; } /** *

* * @return */ public 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 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 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 boolean equals(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()); } @Override public String toString() { return ToString.builder("ConsumerDescription").add("ConsumerName", consumerName()).add("ConsumerARN", consumerARN()) .add("ConsumerStatus", consumerStatusAsString()).add("ConsumerCreationTimestamp", consumerCreationTimestamp()) .add("StreamARN", streamARN()).build(); } public 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(); } } @SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { ConsumerDescriptionMarshaller.getInstance().marshall(this, protocolMarshaller); } public interface Builder extends 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; } @Override public final Builder consumerName(String consumerName) { this.consumerName = consumerName; return this; } public final void setConsumerName(String consumerName) { this.consumerName = consumerName; } public final String getConsumerARN() { return consumerARN; } @Override public final Builder consumerARN(String consumerARN) { this.consumerARN = consumerARN; return this; } public final void setConsumerARN(String consumerARN) { this.consumerARN = consumerARN; } public final String getConsumerStatus() { return consumerStatus; } @Override public final Builder consumerStatus(String consumerStatus) { this.consumerStatus = consumerStatus; return this; } @Override public final Builder consumerStatus(ConsumerStatus consumerStatus) { this.consumerStatus(consumerStatus.toString()); return this; } public final void setConsumerStatus(String consumerStatus) { this.consumerStatus = consumerStatus; } public final Instant getConsumerCreationTimestamp() { return consumerCreationTimestamp; } @Override public final Builder consumerCreationTimestamp(Instant consumerCreationTimestamp) { this.consumerCreationTimestamp = consumerCreationTimestamp; return this; } public final void setConsumerCreationTimestamp(Instant consumerCreationTimestamp) { this.consumerCreationTimestamp = consumerCreationTimestamp; } public final String getStreamARN() { return streamARN; } @Override public final Builder streamARN(String streamARN) { this.streamARN = streamARN; return this; } public final void setStreamARN(String streamARN) { this.streamARN = streamARN; } @Override public ConsumerDescription build() { return new ConsumerDescription(this); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy