
software.amazon.awssdk.services.dynamodb.model.GetShardIteratorRequest Maven / Gradle / Ivy
/*
* 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.dynamodb.model;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents the input of a GetShardIterator
operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetShardIteratorRequest extends DynamoDbStreamsRequest implements
ToCopyableBuilder {
private final String streamArn;
private final String shardId;
private final String shardIteratorType;
private final String sequenceNumber;
private GetShardIteratorRequest(BuilderImpl builder) {
super(builder);
this.streamArn = builder.streamArn;
this.shardId = builder.shardId;
this.shardIteratorType = builder.shardIteratorType;
this.sequenceNumber = builder.sequenceNumber;
}
/**
*
* The Amazon Resource Name (ARN) for the stream.
*
*
* @return The Amazon Resource Name (ARN) for the stream.
*/
public String streamArn() {
return streamArn;
}
/**
*
* The identifier of the shard. The iterator will be returned for this shard ID.
*
*
* @return The identifier of the shard. The iterator will be returned for this shard ID.
*/
public String shardId() {
return shardId;
}
/**
*
* Determines how the shard iterator is used to start reading stream records from the shard:
*
*
* -
*
* AT_SEQUENCE_NUMBER
- Start reading exactly from the position denoted by a specific sequence number.
*
*
* -
*
* AFTER_SEQUENCE_NUMBER
- Start reading right after the position denoted by a specific sequence
* number.
*
*
* -
*
* TRIM_HORIZON
- Start reading at the last (untrimmed) stream record, which is the oldest record in
* the shard. In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this
* limit are subject to removal (trimming) from the stream.
*
*
* -
*
* LATEST
- Start reading just after the most recent stream record in the shard, so that you always
* read the most recent data in the shard.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #shardIteratorType}
* will return {@link ShardIteratorType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #shardIteratorTypeAsString}.
*
*
* @return Determines how the shard iterator is used to start reading stream records from the shard:
*
* -
*
* AT_SEQUENCE_NUMBER
- Start reading exactly from the position denoted by a specific sequence
* number.
*
*
* -
*
* AFTER_SEQUENCE_NUMBER
- Start reading right after the position denoted by a specific
* sequence number.
*
*
* -
*
* TRIM_HORIZON
- Start reading at the last (untrimmed) stream record, which is the oldest
* record in the shard. In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records
* whose age exceeds this limit are subject to removal (trimming) from the stream.
*
*
* -
*
* LATEST
- Start reading just after the most recent stream record in the shard, so that you
* always read the most recent data in the shard.
*
*
* @see ShardIteratorType
*/
public ShardIteratorType shardIteratorType() {
return ShardIteratorType.fromValue(shardIteratorType);
}
/**
*
* Determines how the shard iterator is used to start reading stream records from the shard:
*
*
* -
*
* AT_SEQUENCE_NUMBER
- Start reading exactly from the position denoted by a specific sequence number.
*
*
* -
*
* AFTER_SEQUENCE_NUMBER
- Start reading right after the position denoted by a specific sequence
* number.
*
*
* -
*
* TRIM_HORIZON
- Start reading at the last (untrimmed) stream record, which is the oldest record in
* the shard. In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this
* limit are subject to removal (trimming) from the stream.
*
*
* -
*
* LATEST
- Start reading just after the most recent stream record in the shard, so that you always
* read the most recent data in the shard.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #shardIteratorType}
* will return {@link ShardIteratorType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #shardIteratorTypeAsString}.
*
*
* @return Determines how the shard iterator is used to start reading stream records from the shard:
*
* -
*
* AT_SEQUENCE_NUMBER
- Start reading exactly from the position denoted by a specific sequence
* number.
*
*
* -
*
* AFTER_SEQUENCE_NUMBER
- Start reading right after the position denoted by a specific
* sequence number.
*
*
* -
*
* TRIM_HORIZON
- Start reading at the last (untrimmed) stream record, which is the oldest
* record in the shard. In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records
* whose age exceeds this limit are subject to removal (trimming) from the stream.
*
*
* -
*
* LATEST
- Start reading just after the most recent stream record in the shard, so that you
* always read the most recent data in the shard.
*
*
* @see ShardIteratorType
*/
public String shardIteratorTypeAsString() {
return shardIteratorType;
}
/**
*
* The sequence number of a stream record in the shard from which to start reading.
*
*
* @return The sequence number of a stream record in the shard from which to start reading.
*/
public String sequenceNumber() {
return sequenceNumber;
}
@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(streamArn());
hashCode = 31 * hashCode + Objects.hashCode(shardId());
hashCode = 31 * hashCode + Objects.hashCode(shardIteratorTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(sequenceNumber());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetShardIteratorRequest)) {
return false;
}
GetShardIteratorRequest other = (GetShardIteratorRequest) obj;
return Objects.equals(streamArn(), other.streamArn()) && Objects.equals(shardId(), other.shardId())
&& Objects.equals(shardIteratorTypeAsString(), other.shardIteratorTypeAsString())
&& Objects.equals(sequenceNumber(), other.sequenceNumber());
}
@Override
public String toString() {
return ToString.builder("GetShardIteratorRequest").add("StreamArn", streamArn()).add("ShardId", shardId())
.add("ShardIteratorType", shardIteratorTypeAsString()).add("SequenceNumber", sequenceNumber()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StreamArn":
return Optional.ofNullable(clazz.cast(streamArn()));
case "ShardId":
return Optional.ofNullable(clazz.cast(shardId()));
case "ShardIteratorType":
return Optional.ofNullable(clazz.cast(shardIteratorTypeAsString()));
case "SequenceNumber":
return Optional.ofNullable(clazz.cast(sequenceNumber()));
default:
return Optional.empty();
}
}
public interface Builder extends DynamoDbStreamsRequest.Builder, CopyableBuilder {
/**
*
* The Amazon Resource Name (ARN) for the stream.
*
*
* @param streamArn
* The Amazon Resource Name (ARN) for the stream.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder streamArn(String streamArn);
/**
*
* The identifier of the shard. The iterator will be returned for this shard ID.
*
*
* @param shardId
* The identifier of the shard. The iterator will be returned for this shard ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder shardId(String shardId);
/**
*
* Determines how the shard iterator is used to start reading stream records from the shard:
*
*
* -
*
* AT_SEQUENCE_NUMBER
- Start reading exactly from the position denoted by a specific sequence
* number.
*
*
* -
*
* AFTER_SEQUENCE_NUMBER
- Start reading right after the position denoted by a specific sequence
* number.
*
*
* -
*
* TRIM_HORIZON
- Start reading at the last (untrimmed) stream record, which is the oldest record
* in the shard. In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age
* exceeds this limit are subject to removal (trimming) from the stream.
*
*
* -
*
* LATEST
- Start reading just after the most recent stream record in the shard, so that you always
* read the most recent data in the shard.
*
*
*
*
* @param shardIteratorType
* Determines how the shard iterator is used to start reading stream records from the shard:
*
* -
*
* AT_SEQUENCE_NUMBER
- Start reading exactly from the position denoted by a specific
* sequence number.
*
*
* -
*
* AFTER_SEQUENCE_NUMBER
- Start reading right after the position denoted by a specific
* sequence number.
*
*
* -
*
* TRIM_HORIZON
- Start reading at the last (untrimmed) stream record, which is the oldest
* record in the shard. In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records
* whose age exceeds this limit are subject to removal (trimming) from the stream.
*
*
* -
*
* LATEST
- Start reading just after the most recent stream record in the shard, so that you
* always read the most recent data in the shard.
*
*
* @see ShardIteratorType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ShardIteratorType
*/
Builder shardIteratorType(String shardIteratorType);
/**
*
* Determines how the shard iterator is used to start reading stream records from the shard:
*
*
* -
*
* AT_SEQUENCE_NUMBER
- Start reading exactly from the position denoted by a specific sequence
* number.
*
*
* -
*
* AFTER_SEQUENCE_NUMBER
- Start reading right after the position denoted by a specific sequence
* number.
*
*
* -
*
* TRIM_HORIZON
- Start reading at the last (untrimmed) stream record, which is the oldest record
* in the shard. In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age
* exceeds this limit are subject to removal (trimming) from the stream.
*
*
* -
*
* LATEST
- Start reading just after the most recent stream record in the shard, so that you always
* read the most recent data in the shard.
*
*
*
*
* @param shardIteratorType
* Determines how the shard iterator is used to start reading stream records from the shard:
*
* -
*
* AT_SEQUENCE_NUMBER
- Start reading exactly from the position denoted by a specific
* sequence number.
*
*
* -
*
* AFTER_SEQUENCE_NUMBER
- Start reading right after the position denoted by a specific
* sequence number.
*
*
* -
*
* TRIM_HORIZON
- Start reading at the last (untrimmed) stream record, which is the oldest
* record in the shard. In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records
* whose age exceeds this limit are subject to removal (trimming) from the stream.
*
*
* -
*
* LATEST
- Start reading just after the most recent stream record in the shard, so that you
* always read the most recent data in the shard.
*
*
* @see ShardIteratorType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ShardIteratorType
*/
Builder shardIteratorType(ShardIteratorType shardIteratorType);
/**
*
* The sequence number of a stream record in the shard from which to start reading.
*
*
* @param sequenceNumber
* The sequence number of a stream record in the shard from which to start reading.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sequenceNumber(String sequenceNumber);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends DynamoDbStreamsRequest.BuilderImpl implements Builder {
private String streamArn;
private String shardId;
private String shardIteratorType;
private String sequenceNumber;
private BuilderImpl() {
}
private BuilderImpl(GetShardIteratorRequest model) {
super(model);
streamArn(model.streamArn);
shardId(model.shardId);
shardIteratorType(model.shardIteratorType);
sequenceNumber(model.sequenceNumber);
}
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 getShardId() {
return shardId;
}
@Override
public final Builder shardId(String shardId) {
this.shardId = shardId;
return this;
}
public final void setShardId(String shardId) {
this.shardId = shardId;
}
public final String getShardIteratorType() {
return shardIteratorType;
}
@Override
public final Builder shardIteratorType(String shardIteratorType) {
this.shardIteratorType = shardIteratorType;
return this;
}
@Override
public final Builder shardIteratorType(ShardIteratorType shardIteratorType) {
this.shardIteratorType(shardIteratorType.toString());
return this;
}
public final void setShardIteratorType(String shardIteratorType) {
this.shardIteratorType = shardIteratorType;
}
public final String getSequenceNumber() {
return sequenceNumber;
}
@Override
public final Builder sequenceNumber(String sequenceNumber) {
this.sequenceNumber = sequenceNumber;
return this;
}
public final void setSequenceNumber(String sequenceNumber) {
this.sequenceNumber = sequenceNumber;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public GetShardIteratorRequest build() {
return new GetShardIteratorRequest(this);
}
}
}