
software.amazon.awssdk.services.kinesis.model.ListShardsRequest 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.kinesis.model;
import java.time.Instant;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class ListShardsRequest extends KinesisRequest implements
ToCopyableBuilder {
private final String streamName;
private final String nextToken;
private final String exclusiveStartShardId;
private final Integer maxResults;
private final Instant streamCreationTimestamp;
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;
}
/**
*
* 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 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 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 String exclusiveStartShardId() {
return exclusiveStartShardId;
}
/**
*
* The maximum number of shards to return in a single call to ListShards
. The minimum value you can
* specify for this parameter is 1, and the maximum is 1,000, which is also the default.
*
*
* 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 minimum value you
* can specify for this parameter is 1, and the maximum is 1,000, which is also the default.
*
* 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 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 Instant streamCreationTimestamp() {
return streamCreationTimestamp;
}
@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(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(exclusiveStartShardId());
hashCode = 31 * hashCode + Objects.hashCode(maxResults());
hashCode = 31 * hashCode + Objects.hashCode(streamCreationTimestamp());
return hashCode;
}
@Override
public boolean equals(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());
}
@Override
public String toString() {
return ToString.builder("ListShardsRequest").add("StreamName", streamName()).add("NextToken", nextToken())
.add("ExclusiveStartShardId", exclusiveStartShardId()).add("MaxResults", maxResults())
.add("StreamCreationTimestamp", streamCreationTimestamp()).build();
}
public 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()));
default:
return Optional.empty();
}
}
public interface Builder extends KinesisRequest.Builder, CopyableBuilder {
/**
*
* The name of the data stream whose shards you want to list.
*
*
* You cannot specify this parameter if you specify the NextToken
parameter.
*
*
* @param streamName
* The name of the data stream whose shards you want to list.
*
* You cannot specify this parameter if you specify the NextToken
parameter.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder streamName(String 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
.
*
*
*
* @param nextToken
* 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 Returns a reference to this object so that method calls can be chained together.
*/
Builder nextToken(String 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
.
*
*
* @param exclusiveStartShardId
* 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 Returns a reference to this object so that method calls can be chained together.
*/
Builder exclusiveStartShardId(String exclusiveStartShardId);
/**
*
* The maximum number of shards to return in a single call to ListShards
. The minimum value you can
* specify for this parameter is 1, and the maximum is 1,000, which is also the default.
*
*
* 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.
*
*
* @param maxResults
* The maximum number of shards to return in a single call to ListShards
. The minimum value
* you can specify for this parameter is 1, and the maximum is 1,000, which is also the default.
*
* 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 Returns a reference to this object so that method calls can be chained together.
*/
Builder maxResults(Integer 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.
*
*
* @param streamCreationTimestamp
* 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 Returns a reference to this object so that method calls can be chained together.
*/
Builder streamCreationTimestamp(Instant streamCreationTimestamp);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends KinesisRequest.BuilderImpl implements Builder {
private String streamName;
private String nextToken;
private String exclusiveStartShardId;
private Integer maxResults;
private Instant streamCreationTimestamp;
private BuilderImpl() {
}
private BuilderImpl(ListShardsRequest model) {
super(model);
streamName(model.streamName);
nextToken(model.nextToken);
exclusiveStartShardId(model.exclusiveStartShardId);
maxResults(model.maxResults);
streamCreationTimestamp(model.streamCreationTimestamp);
}
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 getNextToken() {
return nextToken;
}
@Override
public final Builder nextToken(String nextToken) {
this.nextToken = nextToken;
return this;
}
public final void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
public final String getExclusiveStartShardId() {
return exclusiveStartShardId;
}
@Override
public final Builder exclusiveStartShardId(String exclusiveStartShardId) {
this.exclusiveStartShardId = exclusiveStartShardId;
return this;
}
public final void setExclusiveStartShardId(String exclusiveStartShardId) {
this.exclusiveStartShardId = exclusiveStartShardId;
}
public final Integer getMaxResults() {
return maxResults;
}
@Override
public final Builder maxResults(Integer maxResults) {
this.maxResults = maxResults;
return this;
}
public final void setMaxResults(Integer maxResults) {
this.maxResults = maxResults;
}
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;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public ListShardsRequest build() {
return new ListShardsRequest(this);
}
}
}