
software.amazon.awssdk.services.dynamodb.model.GetShardIteratorRequest Maven / Gradle / Ivy
/*
* 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.dynamodb.model;
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.awscore.AwsRequestOverrideConfiguration;
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;
/**
*
* Represents the input of a GetShardIterator
operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetShardIteratorRequest extends DynamoDbStreamsRequest implements
ToCopyableBuilder {
private static final SdkField STREAM_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StreamArn").getter(getter(GetShardIteratorRequest::streamArn)).setter(setter(Builder::streamArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StreamArn").build()).build();
private static final SdkField SHARD_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ShardId").getter(getter(GetShardIteratorRequest::shardId)).setter(setter(Builder::shardId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ShardId").build()).build();
private static final SdkField SHARD_ITERATOR_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ShardIteratorType").getter(getter(GetShardIteratorRequest::shardIteratorTypeAsString))
.setter(setter(Builder::shardIteratorType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ShardIteratorType").build()).build();
private static final SdkField SEQUENCE_NUMBER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SequenceNumber").getter(getter(GetShardIteratorRequest::sequenceNumber))
.setter(setter(Builder::sequenceNumber))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SequenceNumber").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STREAM_ARN_FIELD,
SHARD_ID_FIELD, SHARD_ITERATOR_TYPE_FIELD, SEQUENCE_NUMBER_FIELD));
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 final 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 final 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 final 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 final 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 final 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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
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 final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(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());
}
/**
* 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("GetShardIteratorRequest").add("StreamArn", streamArn()).add("ShardId", shardId())
.add("ShardIteratorType", shardIteratorTypeAsString()).add("SequenceNumber", sequenceNumber()).build();
}
public final 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();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function