software.amazon.awssdk.services.kinesis.model.StreamDescriptionSummary Maven / Gradle / Ivy
Show all versions of kinesis Show documentation
/*
* 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.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.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.StreamDescriptionSummaryMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents the output for DescribeStreamSummary
*
*/
@Generated("software.amazon.awssdk:codegen")
public class StreamDescriptionSummary implements StructuredPojo,
ToCopyableBuilder {
private final String streamName;
private final String streamARN;
private final String streamStatus;
private final Integer retentionPeriodHours;
private final Instant streamCreationTimestamp;
private final List enhancedMonitoring;
private final String encryptionType;
private final String keyId;
private final Integer openShardCount;
private StreamDescriptionSummary(BuilderImpl builder) {
this.streamName = builder.streamName;
this.streamARN = builder.streamARN;
this.streamStatus = builder.streamStatus;
this.retentionPeriodHours = builder.retentionPeriodHours;
this.streamCreationTimestamp = builder.streamCreationTimestamp;
this.enhancedMonitoring = builder.enhancedMonitoring;
this.encryptionType = builder.encryptionType;
this.keyId = builder.keyId;
this.openShardCount = builder.openShardCount;
}
/**
*
* The name of the stream being described.
*
*
* @return The name of the stream being described.
*/
public String streamName() {
return streamName;
}
/**
*
* The Amazon Resource Name (ARN) for the stream being described.
*
*
* @return The Amazon Resource Name (ARN) for the stream being described.
*/
public String streamARN() {
return streamARN;
}
/**
*
* The current status of the stream being described. The stream status is one of the following states:
*
*
* -
*
* CREATING
- The stream is being created. Kinesis Streams immediately returns and sets
* StreamStatus
to CREATING
.
*
*
* -
*
* DELETING
- The stream is being deleted. The specified stream is in the DELETING
state
* until Kinesis Streams completes the deletion.
*
*
* -
*
* ACTIVE
- The stream exists and is ready for read and write operations or deletion. You should
* perform read and write operations only on an ACTIVE
stream.
*
*
* -
*
* UPDATING
- Shards in the stream are being merged or split. Read and write operations continue to
* work while the stream is in the UPDATING
state.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #streamStatus} will
* return {@link StreamStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #streamStatusString}.
*
*
* @return The current status of the stream being described. The stream status is one of the following states:
*
* -
*
* CREATING
- The stream is being created. Kinesis Streams immediately returns and sets
* StreamStatus
to CREATING
.
*
*
* -
*
* DELETING
- The stream is being deleted. The specified stream is in the DELETING
* state until Kinesis Streams completes the deletion.
*
*
* -
*
* ACTIVE
- The stream exists and is ready for read and write operations or deletion. You
* should perform read and write operations only on an ACTIVE
stream.
*
*
* -
*
* UPDATING
- Shards in the stream are being merged or split. Read and write operations
* continue to work while the stream is in the UPDATING
state.
*
*
* @see StreamStatus
*/
public StreamStatus streamStatus() {
return StreamStatus.fromValue(streamStatus);
}
/**
*
* The current status of the stream being described. The stream status is one of the following states:
*
*
* -
*
* CREATING
- The stream is being created. Kinesis Streams immediately returns and sets
* StreamStatus
to CREATING
.
*
*
* -
*
* DELETING
- The stream is being deleted. The specified stream is in the DELETING
state
* until Kinesis Streams completes the deletion.
*
*
* -
*
* ACTIVE
- The stream exists and is ready for read and write operations or deletion. You should
* perform read and write operations only on an ACTIVE
stream.
*
*
* -
*
* UPDATING
- Shards in the stream are being merged or split. Read and write operations continue to
* work while the stream is in the UPDATING
state.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #streamStatus} will
* return {@link StreamStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #streamStatusString}.
*
*
* @return The current status of the stream being described. The stream status is one of the following states:
*
* -
*
* CREATING
- The stream is being created. Kinesis Streams immediately returns and sets
* StreamStatus
to CREATING
.
*
*
* -
*
* DELETING
- The stream is being deleted. The specified stream is in the DELETING
* state until Kinesis Streams completes the deletion.
*
*
* -
*
* ACTIVE
- The stream exists and is ready for read and write operations or deletion. You
* should perform read and write operations only on an ACTIVE
stream.
*
*
* -
*
* UPDATING
- Shards in the stream are being merged or split. Read and write operations
* continue to work while the stream is in the UPDATING
state.
*
*
* @see StreamStatus
*/
public String streamStatusString() {
return streamStatus;
}
/**
*
* The current retention period, in hours.
*
*
* @return The current retention period, in hours.
*/
public Integer retentionPeriodHours() {
return retentionPeriodHours;
}
/**
*
* The approximate time that the stream was created.
*
*
* @return The approximate time that the stream was created.
*/
public Instant streamCreationTimestamp() {
return streamCreationTimestamp;
}
/**
*
* Represents the current enhanced monitoring settings of the stream.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return Represents the current enhanced monitoring settings of the stream.
*/
public List enhancedMonitoring() {
return enhancedMonitoring;
}
/**
*
* The encryption type used. This value is one of the following:
*
*
* -
*
* KMS
*
*
* -
*
* NONE
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #encryptionType}
* will return {@link EncryptionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #encryptionTypeString}.
*
*
* @return The encryption type used. This value is one of the following:
*
* -
*
* KMS
*
*
* -
*
* NONE
*
*
* @see EncryptionType
*/
public EncryptionType encryptionType() {
return EncryptionType.fromValue(encryptionType);
}
/**
*
* The encryption type used. This value is one of the following:
*
*
* -
*
* KMS
*
*
* -
*
* NONE
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #encryptionType}
* will return {@link EncryptionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #encryptionTypeString}.
*
*
* @return The encryption type used. This value is one of the following:
*
* -
*
* KMS
*
*
* -
*
* NONE
*
*
* @see EncryptionType
*/
public String encryptionTypeString() {
return encryptionType;
}
/**
*
* The GUID for the customer-managed KMS key to use for encryption. This value can be a globally unique identifier,
* a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".You can also use a
* master key owned by Kinesis Streams by specifying the alias aws/kinesis
.
*
*
* -
*
* Key ARN example: arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
*
*
* -
*
* Alias ARN example: arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
*
*
* -
*
* Globally unique key ID example: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Alias name example: alias/MyAliasName
*
*
* -
*
* Master key owned by Kinesis: alias/aws/kinesis
*
*
*
*
* @return The GUID for the customer-managed KMS key to use for encryption. This value can be a globally unique
* identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".You
* can also use a master key owned by Kinesis Streams by specifying the alias aws/kinesis
.
*
* -
*
* Key ARN example: arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
*
*
* -
*
* Alias ARN example: arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
*
*
* -
*
* Globally unique key ID example: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Alias name example: alias/MyAliasName
*
*
* -
*
* Master key owned by Kinesis: alias/aws/kinesis
*
*
*/
public String keyId() {
return keyId;
}
/**
*
* The number of open shards in the stream.
*
*
* @return The number of open shards in the stream.
*/
public Integer openShardCount() {
return openShardCount;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(streamName());
hashCode = 31 * hashCode + Objects.hashCode(streamARN());
hashCode = 31 * hashCode + Objects.hashCode(streamStatusString());
hashCode = 31 * hashCode + Objects.hashCode(retentionPeriodHours());
hashCode = 31 * hashCode + Objects.hashCode(streamCreationTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(enhancedMonitoring());
hashCode = 31 * hashCode + Objects.hashCode(encryptionTypeString());
hashCode = 31 * hashCode + Objects.hashCode(keyId());
hashCode = 31 * hashCode + Objects.hashCode(openShardCount());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof StreamDescriptionSummary)) {
return false;
}
StreamDescriptionSummary other = (StreamDescriptionSummary) obj;
return Objects.equals(streamName(), other.streamName()) && Objects.equals(streamARN(), other.streamARN())
&& Objects.equals(streamStatusString(), other.streamStatusString())
&& Objects.equals(retentionPeriodHours(), other.retentionPeriodHours())
&& Objects.equals(streamCreationTimestamp(), other.streamCreationTimestamp())
&& Objects.equals(enhancedMonitoring(), other.enhancedMonitoring())
&& Objects.equals(encryptionTypeString(), other.encryptionTypeString()) && Objects.equals(keyId(), other.keyId())
&& Objects.equals(openShardCount(), other.openShardCount());
}
@Override
public String toString() {
return ToString.builder("StreamDescriptionSummary").add("StreamName", streamName()).add("StreamARN", streamARN())
.add("StreamStatus", streamStatusString()).add("RetentionPeriodHours", retentionPeriodHours())
.add("StreamCreationTimestamp", streamCreationTimestamp()).add("EnhancedMonitoring", enhancedMonitoring())
.add("EncryptionType", encryptionTypeString()).add("KeyId", keyId()).add("OpenShardCount", openShardCount())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StreamName":
return Optional.of(clazz.cast(streamName()));
case "StreamARN":
return Optional.of(clazz.cast(streamARN()));
case "StreamStatus":
return Optional.of(clazz.cast(streamStatusString()));
case "RetentionPeriodHours":
return Optional.of(clazz.cast(retentionPeriodHours()));
case "StreamCreationTimestamp":
return Optional.of(clazz.cast(streamCreationTimestamp()));
case "EnhancedMonitoring":
return Optional.of(clazz.cast(enhancedMonitoring()));
case "EncryptionType":
return Optional.of(clazz.cast(encryptionTypeString()));
case "KeyId":
return Optional.of(clazz.cast(keyId()));
case "OpenShardCount":
return Optional.of(clazz.cast(openShardCount()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
StreamDescriptionSummaryMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The name of the stream being described.
*
*
* @param streamName
* The name of the stream being described.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder streamName(String streamName);
/**
*
* The Amazon Resource Name (ARN) for the stream being described.
*
*
* @param streamARN
* The Amazon Resource Name (ARN) for the stream being described.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder streamARN(String streamARN);
/**
*
* The current status of the stream being described. The stream status is one of the following states:
*
*
* -
*
* CREATING
- The stream is being created. Kinesis Streams immediately returns and sets
* StreamStatus
to CREATING
.
*
*
* -
*
* DELETING
- The stream is being deleted. The specified stream is in the DELETING
* state until Kinesis Streams completes the deletion.
*
*
* -
*
* ACTIVE
- The stream exists and is ready for read and write operations or deletion. You should
* perform read and write operations only on an ACTIVE
stream.
*
*
* -
*
* UPDATING
- Shards in the stream are being merged or split. Read and write operations continue to
* work while the stream is in the UPDATING
state.
*
*
*
*
* @param streamStatus
* The current status of the stream being described. The stream status is one of the following
* states:
*
* -
*
* CREATING
- The stream is being created. Kinesis Streams immediately returns and sets
* StreamStatus
to CREATING
.
*
*
* -
*
* DELETING
- The stream is being deleted. The specified stream is in the
* DELETING
state until Kinesis Streams completes the deletion.
*
*
* -
*
* ACTIVE
- The stream exists and is ready for read and write operations or deletion. You
* should perform read and write operations only on an ACTIVE
stream.
*
*
* -
*
* UPDATING
- Shards in the stream are being merged or split. Read and write operations
* continue to work while the stream is in the UPDATING
state.
*
*
* @see StreamStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see StreamStatus
*/
Builder streamStatus(String streamStatus);
/**
*
* The current status of the stream being described. The stream status is one of the following states:
*
*
* -
*
* CREATING
- The stream is being created. Kinesis Streams immediately returns and sets
* StreamStatus
to CREATING
.
*
*
* -
*
* DELETING
- The stream is being deleted. The specified stream is in the DELETING
* state until Kinesis Streams completes the deletion.
*
*
* -
*
* ACTIVE
- The stream exists and is ready for read and write operations or deletion. You should
* perform read and write operations only on an ACTIVE
stream.
*
*
* -
*
* UPDATING
- Shards in the stream are being merged or split. Read and write operations continue to
* work while the stream is in the UPDATING
state.
*
*
*
*
* @param streamStatus
* The current status of the stream being described. The stream status is one of the following
* states:
*
* -
*
* CREATING
- The stream is being created. Kinesis Streams immediately returns and sets
* StreamStatus
to CREATING
.
*
*
* -
*
* DELETING
- The stream is being deleted. The specified stream is in the
* DELETING
state until Kinesis Streams completes the deletion.
*
*
* -
*
* ACTIVE
- The stream exists and is ready for read and write operations or deletion. You
* should perform read and write operations only on an ACTIVE
stream.
*
*
* -
*
* UPDATING
- Shards in the stream are being merged or split. Read and write operations
* continue to work while the stream is in the UPDATING
state.
*
*
* @see StreamStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see StreamStatus
*/
Builder streamStatus(StreamStatus streamStatus);
/**
*
* The current retention period, in hours.
*
*
* @param retentionPeriodHours
* The current retention period, in hours.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder retentionPeriodHours(Integer retentionPeriodHours);
/**
*
* The approximate time that the stream was created.
*
*
* @param streamCreationTimestamp
* The approximate time that the stream was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder streamCreationTimestamp(Instant streamCreationTimestamp);
/**
*
* Represents the current enhanced monitoring settings of the stream.
*
*
* @param enhancedMonitoring
* Represents the current enhanced monitoring settings of the stream.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder enhancedMonitoring(Collection enhancedMonitoring);
/**
*
* Represents the current enhanced monitoring settings of the stream.
*
*
* @param enhancedMonitoring
* Represents the current enhanced monitoring settings of the stream.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder enhancedMonitoring(EnhancedMetrics... enhancedMonitoring);
/**
*
* The encryption type used. This value is one of the following:
*
*
* -
*
* KMS
*
*
* -
*
* NONE
*
*
*
*
* @param encryptionType
* The encryption type used. This value is one of the following:
*
* -
*
* KMS
*
*
* -
*
* NONE
*
*
* @see EncryptionType
* @return Returns a reference to this object so that method calls can be chained together.
* @see EncryptionType
*/
Builder encryptionType(String encryptionType);
/**
*
* The encryption type used. This value is one of the following:
*
*
* -
*
* KMS
*
*
* -
*
* NONE
*
*
*
*
* @param encryptionType
* The encryption type used. This value is one of the following:
*
* -
*
* KMS
*
*
* -
*
* NONE
*
*
* @see EncryptionType
* @return Returns a reference to this object so that method calls can be chained together.
* @see EncryptionType
*/
Builder encryptionType(EncryptionType encryptionType);
/**
*
* The GUID for the customer-managed KMS key to use for encryption. This value can be a globally unique
* identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".You can
* also use a master key owned by Kinesis Streams by specifying the alias aws/kinesis
.
*
*
* -
*
* Key ARN example: arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
*
*
* -
*
* Alias ARN example: arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
*
*
* -
*
* Globally unique key ID example: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Alias name example: alias/MyAliasName
*
*
* -
*
* Master key owned by Kinesis: alias/aws/kinesis
*
*
*
*
* @param keyId
* The GUID for the customer-managed KMS key to use for encryption. This value can be a globally unique
* identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by
* "alias/".You can also use a master key owned by Kinesis Streams by specifying the alias
* aws/kinesis
.
*
* -
*
* Key ARN example:
* arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
*
*
* -
*
* Alias ARN example: arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
*
*
* -
*
* Globally unique key ID example: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Alias name example: alias/MyAliasName
*
*
* -
*
* Master key owned by Kinesis: alias/aws/kinesis
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder keyId(String keyId);
/**
*
* The number of open shards in the stream.
*
*
* @param openShardCount
* The number of open shards in the stream.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder openShardCount(Integer openShardCount);
}
static final class BuilderImpl implements Builder {
private String streamName;
private String streamARN;
private String streamStatus;
private Integer retentionPeriodHours;
private Instant streamCreationTimestamp;
private List enhancedMonitoring;
private String encryptionType;
private String keyId;
private Integer openShardCount;
private BuilderImpl() {
}
private BuilderImpl(StreamDescriptionSummary model) {
streamName(model.streamName);
streamARN(model.streamARN);
streamStatus(model.streamStatus);
retentionPeriodHours(model.retentionPeriodHours);
streamCreationTimestamp(model.streamCreationTimestamp);
enhancedMonitoring(model.enhancedMonitoring);
encryptionType(model.encryptionType);
keyId(model.keyId);
openShardCount(model.openShardCount);
}
public final String getStreamName() {
return streamName;
}
@Override
public final Builder streamName(String streamName) {
this.streamName = streamName;
return this;
}
public final void setStreamName(String streamName) {
this.streamName = streamName;
}
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;
}
public final String getStreamStatus() {
return streamStatus;
}
@Override
public final Builder streamStatus(String streamStatus) {
this.streamStatus = streamStatus;
return this;
}
@Override
public final Builder streamStatus(StreamStatus streamStatus) {
this.streamStatus(streamStatus.toString());
return this;
}
public final void setStreamStatus(String streamStatus) {
this.streamStatus = streamStatus;
}
public final Integer getRetentionPeriodHours() {
return retentionPeriodHours;
}
@Override
public final Builder retentionPeriodHours(Integer retentionPeriodHours) {
this.retentionPeriodHours = retentionPeriodHours;
return this;
}
public final void setRetentionPeriodHours(Integer retentionPeriodHours) {
this.retentionPeriodHours = retentionPeriodHours;
}
public final Instant getStreamCreationTimestamp() {
return streamCreationTimestamp;
}
@Override
public final Builder streamCreationTimestamp(Instant streamCreationTimestamp) {
this.streamCreationTimestamp = streamCreationTimestamp;
return this;
}
public final void setStreamCreationTimestamp(Instant streamCreationTimestamp) {
this.streamCreationTimestamp = streamCreationTimestamp;
}
public final Collection getEnhancedMonitoring() {
return enhancedMonitoring != null ? enhancedMonitoring.stream().map(EnhancedMetrics::toBuilder)
.collect(Collectors.toList()) : null;
}
@Override
public final Builder enhancedMonitoring(Collection enhancedMonitoring) {
this.enhancedMonitoring = EnhancedMonitoringListCopier.copy(enhancedMonitoring);
return this;
}
@Override
@SafeVarargs
public final Builder enhancedMonitoring(EnhancedMetrics... enhancedMonitoring) {
enhancedMonitoring(Arrays.asList(enhancedMonitoring));
return this;
}
public final void setEnhancedMonitoring(Collection enhancedMonitoring) {
this.enhancedMonitoring = EnhancedMonitoringListCopier.copyFromBuilder(enhancedMonitoring);
}
public final String getEncryptionType() {
return encryptionType;
}
@Override
public final Builder encryptionType(String encryptionType) {
this.encryptionType = encryptionType;
return this;
}
@Override
public final Builder encryptionType(EncryptionType encryptionType) {
this.encryptionType(encryptionType.toString());
return this;
}
public final void setEncryptionType(String encryptionType) {
this.encryptionType = encryptionType;
}
public final String getKeyId() {
return keyId;
}
@Override
public final Builder keyId(String keyId) {
this.keyId = keyId;
return this;
}
public final void setKeyId(String keyId) {
this.keyId = keyId;
}
public final Integer getOpenShardCount() {
return openShardCount;
}
@Override
public final Builder openShardCount(Integer openShardCount) {
this.openShardCount = openShardCount;
return this;
}
public final void setOpenShardCount(Integer openShardCount) {
this.openShardCount = openShardCount;
}
@Override
public StreamDescriptionSummary build() {
return new StreamDescriptionSummary(this);
}
}
}