software.amazon.awssdk.services.kinesis.model.ListShardsRequest Maven / Gradle / Ivy
Show all versions of kinesis Show documentation
/*
* 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.time.Instant;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class ListShardsRequest extends KinesisRequest implements
ToCopyableBuilder {
private static final SdkField STREAM_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StreamName").getter(getter(ListShardsRequest::streamName)).setter(setter(Builder::streamName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StreamName").build()).build();
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NextToken").getter(getter(ListShardsRequest::nextToken)).setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextToken").build()).build();
private static final SdkField EXCLUSIVE_START_SHARD_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ExclusiveStartShardId").getter(getter(ListShardsRequest::exclusiveStartShardId))
.setter(setter(Builder::exclusiveStartShardId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExclusiveStartShardId").build())
.build();
private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MaxResults").getter(getter(ListShardsRequest::maxResults)).setter(setter(Builder::maxResults))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxResults").build()).build();
private static final SdkField STREAM_CREATION_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StreamCreationTimestamp").getter(getter(ListShardsRequest::streamCreationTimestamp))
.setter(setter(Builder::streamCreationTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StreamCreationTimestamp").build())
.build();
private static final SdkField SHARD_FILTER_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("ShardFilter").getter(getter(ListShardsRequest::shardFilter)).setter(setter(Builder::shardFilter))
.constructor(ShardFilter::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ShardFilter").build()).build();
private static final SdkField STREAM_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StreamARN").getter(getter(ListShardsRequest::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(STREAM_NAME_FIELD,
NEXT_TOKEN_FIELD, EXCLUSIVE_START_SHARD_ID_FIELD, MAX_RESULTS_FIELD, STREAM_CREATION_TIMESTAMP_FIELD,
SHARD_FILTER_FIELD, STREAM_ARN_FIELD));
private final String streamName;
private final String nextToken;
private final String exclusiveStartShardId;
private final Integer maxResults;
private final Instant streamCreationTimestamp;
private final ShardFilter shardFilter;
private final String streamARN;
private ListShardsRequest(BuilderImpl builder) {
super(builder);
this.streamName = builder.streamName;
this.nextToken = builder.nextToken;
this.exclusiveStartShardId = builder.exclusiveStartShardId;
this.maxResults = builder.maxResults;
this.streamCreationTimestamp = builder.streamCreationTimestamp;
this.shardFilter = builder.shardFilter;
this.streamARN = builder.streamARN;
}
/**
*
* The name of the data stream whose shards you want to list.
*
*
* You cannot specify this parameter if you specify the NextToken
parameter.
*
*
* @return The name of the data stream whose shards you want to list.
*
* You cannot specify this parameter if you specify the NextToken
parameter.
*/
public final String streamName() {
return streamName;
}
/**
*
* When the number of shards in the data stream is greater than the default value for the MaxResults
* parameter, or if you explicitly specify a value for MaxResults
that is less than the number of
* shards in the data stream, the response includes a pagination token named NextToken
. You can specify
* this NextToken
value in a subsequent call to ListShards
to list the next set of shards.
*
*
* Don't specify StreamName
or StreamCreationTimestamp
if you specify
* NextToken
because the latter unambiguously identifies the stream.
*
*
* You can optionally specify a value for the MaxResults
parameter when you specify
* NextToken
. If you specify a MaxResults
value that is less than the number of shards
* that the operation returns if you don't specify MaxResults
, the response will contain a new
* NextToken
value. You can use the new NextToken
value in a subsequent call to the
* ListShards
operation.
*
*
*
* Tokens expire after 300 seconds. When you obtain a value for NextToken
in the response to a call to
* ListShards
, you have 300 seconds to use that value. If you specify an expired token in a call to
* ListShards
, you get ExpiredNextTokenException
.
*
*
*
* @return When the number of shards in the data stream is greater than the default value for the
* MaxResults
parameter, or if you explicitly specify a value for MaxResults
that
* is less than the number of shards in the data stream, the response includes a pagination token named
* NextToken
. You can specify this NextToken
value in a subsequent call to
* ListShards
to list the next set of shards.
*
* Don't specify StreamName
or StreamCreationTimestamp
if you specify
* NextToken
because the latter unambiguously identifies the stream.
*
*
* You can optionally specify a value for the MaxResults
parameter when you specify
* NextToken
. If you specify a MaxResults
value that is less than the number of
* shards that the operation returns if you don't specify MaxResults
, the response will contain
* a new NextToken
value. You can use the new NextToken
value in a subsequent call
* to the ListShards
operation.
*
*
*
* Tokens expire after 300 seconds. When you obtain a value for NextToken
in the response to a
* call to ListShards
, you have 300 seconds to use that value. If you specify an expired token
* in a call to ListShards
, you get ExpiredNextTokenException
.
*
*/
public final String nextToken() {
return nextToken;
}
/**
*
* Specify this parameter to indicate that you want to list the shards starting with the shard whose ID immediately
* follows ExclusiveStartShardId
.
*
*
* If you don't specify this parameter, the default behavior is for ListShards
to list the shards
* starting with the first one in the stream.
*
*
* You cannot specify this parameter if you specify NextToken
.
*
*
* @return Specify this parameter to indicate that you want to list the shards starting with the shard whose ID
* immediately follows ExclusiveStartShardId
.
*
* If you don't specify this parameter, the default behavior is for ListShards
to list the
* shards starting with the first one in the stream.
*
*
* You cannot specify this parameter if you specify NextToken
.
*/
public final String exclusiveStartShardId() {
return exclusiveStartShardId;
}
/**
*
* The maximum number of shards to return in a single call to ListShards
. The maximum number of shards
* to return in a single call. The default value is 1000. If you specify a value greater than 1000, at most 1000
* results are returned.
*
*
* When the number of shards to be listed is greater than the value of MaxResults
, the response
* contains a NextToken
value that you can use in a subsequent call to ListShards
to list
* the next set of shards.
*
*
* @return The maximum number of shards to return in a single call to ListShards
. The maximum number of
* shards to return in a single call. The default value is 1000. If you specify a value greater than 1000,
* at most 1000 results are returned.
*
* When the number of shards to be listed is greater than the value of MaxResults
, the response
* contains a NextToken
value that you can use in a subsequent call to ListShards
* to list the next set of shards.
*/
public final Integer maxResults() {
return maxResults;
}
/**
*
* Specify this input parameter to distinguish data streams that have the same name. For example, if you create a
* data stream and then delete it, and you later create another data stream with the same name, you can use this
* input parameter to specify which of the two streams you want to list the shards for.
*
*
* You cannot specify this parameter if you specify the NextToken
parameter.
*
*
* @return Specify this input parameter to distinguish data streams that have the same name. For example, if you
* create a data stream and then delete it, and you later create another data stream with the same name, you
* can use this input parameter to specify which of the two streams you want to list the shards for.
*
* You cannot specify this parameter if you specify the NextToken
parameter.
*/
public final Instant streamCreationTimestamp() {
return streamCreationTimestamp;
}
/**
*
* Enables you to filter out the response of the ListShards
API. You can only specify one filter at a
* time.
*
*
* If you use the ShardFilter
parameter when invoking the ListShards API, the Type
is the
* required property and must be specified. If you specify the AT_TRIM_HORIZON
,
* FROM_TRIM_HORIZON
, or AT_LATEST
types, you do not need to specify either the
* ShardId
or the Timestamp
optional properties.
*
*
* If you specify the AFTER_SHARD_ID
type, you must also provide the value for the optional
* ShardId
property. The ShardId
property is identical in fuctionality to the
* ExclusiveStartShardId
parameter of the ListShards
API. When ShardId
* property is specified, the response includes the shards starting with the shard whose ID immediately follows the
* ShardId
that you provided.
*
*
* If you specify the AT_TIMESTAMP
or FROM_TIMESTAMP_ID
type, you must also provide the
* value for the optional Timestamp
property. If you specify the AT_TIMESTAMP type, then all shards
* that were open at the provided timestamp are returned. If you specify the FROM_TIMESTAMP type, then all shards
* starting from the provided timestamp to TIP are returned.
*
*
* @return Enables you to filter out the response of the ListShards
API. You can only specify one
* filter at a time.
*
* If you use the ShardFilter
parameter when invoking the ListShards API, the Type
* is the required property and must be specified. If you specify the AT_TRIM_HORIZON
,
* FROM_TRIM_HORIZON
, or AT_LATEST
types, you do not need to specify either the
* ShardId
or the Timestamp
optional properties.
*
*
* If you specify the AFTER_SHARD_ID
type, you must also provide the value for the optional
* ShardId
property. The ShardId
property is identical in fuctionality to the
* ExclusiveStartShardId
parameter of the ListShards
API. When
* ShardId
property is specified, the response includes the shards starting with the shard
* whose ID immediately follows the ShardId
that you provided.
*
*
* If you specify the AT_TIMESTAMP
or FROM_TIMESTAMP_ID
type, you must also
* provide the value for the optional Timestamp
property. If you specify the AT_TIMESTAMP type,
* then all shards that were open at the provided timestamp are returned. If you specify the FROM_TIMESTAMP
* type, then all shards starting from the provided timestamp to TIP are returned.
*/
public final ShardFilter shardFilter() {
return shardFilter;
}
/**
*
* The ARN of the stream.
*
*
* @return The ARN of the stream.
*/
public final String streamARN() {
return streamARN;
}
@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(streamName());
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(exclusiveStartShardId());
hashCode = 31 * hashCode + Objects.hashCode(maxResults());
hashCode = 31 * hashCode + Objects.hashCode(streamCreationTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(shardFilter());
hashCode = 31 * hashCode + Objects.hashCode(streamARN());
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 ListShardsRequest)) {
return false;
}
ListShardsRequest other = (ListShardsRequest) obj;
return Objects.equals(streamName(), other.streamName()) && Objects.equals(nextToken(), other.nextToken())
&& Objects.equals(exclusiveStartShardId(), other.exclusiveStartShardId())
&& Objects.equals(maxResults(), other.maxResults())
&& Objects.equals(streamCreationTimestamp(), other.streamCreationTimestamp())
&& Objects.equals(shardFilter(), other.shardFilter()) && 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("ListShardsRequest").add("StreamName", streamName()).add("NextToken", nextToken())
.add("ExclusiveStartShardId", exclusiveStartShardId()).add("MaxResults", maxResults())
.add("StreamCreationTimestamp", streamCreationTimestamp()).add("ShardFilter", shardFilter())
.add("StreamARN", streamARN()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StreamName":
return Optional.ofNullable(clazz.cast(streamName()));
case "NextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
case "ExclusiveStartShardId":
return Optional.ofNullable(clazz.cast(exclusiveStartShardId()));
case "MaxResults":
return Optional.ofNullable(clazz.cast(maxResults()));
case "StreamCreationTimestamp":
return Optional.ofNullable(clazz.cast(streamCreationTimestamp()));
case "ShardFilter":
return Optional.ofNullable(clazz.cast(shardFilter()));
case "StreamARN":
return Optional.ofNullable(clazz.cast(streamARN()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function