aws_sdk_kinesis/operation/get_shard_iterator/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_shard_iterator::_get_shard_iterator_output::GetShardIteratorOutputBuilder;
3
4pub use crate::operation::get_shard_iterator::_get_shard_iterator_input::GetShardIteratorInputBuilder;
5
6impl crate::operation::get_shard_iterator::builders::GetShardIteratorInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::get_shard_iterator::GetShardIteratorOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_shard_iterator::GetShardIteratorError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_shard_iterator();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetShardIterator`.
24///
25/// <p>Gets an Amazon Kinesis shard iterator. A shard iterator expires 5 minutes after it is returned to the requester.</p><note>
26/// <p>When invoking this API, you must use either the <code>StreamARN</code> or the <code>StreamName</code> parameter, or both. It is recommended that you use the <code>StreamARN</code> input parameter when you invoke this API.</p>
27/// </note>
28/// <p>A shard iterator specifies the shard position from which to start reading data records sequentially. The position is specified using the sequence number of a data record in a shard. A sequence number is the identifier associated with every record ingested in the stream, and is assigned when a record is put into the stream. Each stream has one or more shards.</p>
29/// <p>You must specify the shard iterator type. For example, you can set the <code>ShardIteratorType</code> parameter to read exactly from the position denoted by a specific sequence number by using the <code>AT_SEQUENCE_NUMBER</code> shard iterator type. Alternatively, the parameter can read right after the sequence number by using the <code>AFTER_SEQUENCE_NUMBER</code> shard iterator type, using sequence numbers returned by earlier calls to <code>PutRecord</code>, <code>PutRecords</code>, <code>GetRecords</code>, or <code>DescribeStream</code>. In the request, you can specify the shard iterator type <code>AT_TIMESTAMP</code> to read records from an arbitrary point in time, <code>TRIM_HORIZON</code> to cause <code>ShardIterator</code> to point to the last untrimmed record in the shard in the system (the oldest data record in the shard), or <code>LATEST</code> so that you always read the most recent data in the shard.</p>
30/// <p>When you read repeatedly from a stream, use a <code>GetShardIterator</code> request to get the first shard iterator for use in your first <code>GetRecords</code> request and for subsequent reads use the shard iterator returned by the <code>GetRecords</code> request in <code>NextShardIterator</code>. A new shard iterator is returned by every <code>GetRecords</code> request in <code>NextShardIterator</code>, which you use in the <code>ShardIterator</code> parameter of the next <code>GetRecords</code> request.</p>
31/// <p>If a <code>GetShardIterator</code> request is made too often, you receive a <code>ProvisionedThroughputExceededException</code>. For more information about throughput limits, see <code>GetRecords</code>, and <a href="https://docs.aws.amazon.com/kinesis/latest/dev/service-sizes-and-limits.html">Streams Limits</a> in the <i>Amazon Kinesis Data Streams Developer Guide</i>.</p>
32/// <p>If the shard is closed, <code>GetShardIterator</code> returns a valid iterator for the last sequence number of the shard. A shard can be closed as a result of using <code>SplitShard</code> or <code>MergeShards</code>.</p>
33/// <p><code>GetShardIterator</code> has a limit of five transactions per second per account per open shard.</p>
34#[derive(::std::clone::Clone, ::std::fmt::Debug)]
35pub struct GetShardIteratorFluentBuilder {
36    handle: ::std::sync::Arc<crate::client::Handle>,
37    inner: crate::operation::get_shard_iterator::builders::GetShardIteratorInputBuilder,
38    config_override: ::std::option::Option<crate::config::Builder>,
39}
40impl
41    crate::client::customize::internal::CustomizableSend<
42        crate::operation::get_shard_iterator::GetShardIteratorOutput,
43        crate::operation::get_shard_iterator::GetShardIteratorError,
44    > for GetShardIteratorFluentBuilder
45{
46    fn send(
47        self,
48        config_override: crate::config::Builder,
49    ) -> crate::client::customize::internal::BoxFuture<
50        crate::client::customize::internal::SendResult<
51            crate::operation::get_shard_iterator::GetShardIteratorOutput,
52            crate::operation::get_shard_iterator::GetShardIteratorError,
53        >,
54    > {
55        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
56    }
57}
58impl GetShardIteratorFluentBuilder {
59    /// Creates a new `GetShardIteratorFluentBuilder`.
60    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
61        Self {
62            handle,
63            inner: ::std::default::Default::default(),
64            config_override: ::std::option::Option::None,
65        }
66    }
67    /// Access the GetShardIterator as a reference.
68    pub fn as_input(&self) -> &crate::operation::get_shard_iterator::builders::GetShardIteratorInputBuilder {
69        &self.inner
70    }
71    /// Sends the request and returns the response.
72    ///
73    /// If an error occurs, an `SdkError` will be returned with additional details that
74    /// can be matched against.
75    ///
76    /// By default, any retryable failures will be retried twice. Retry behavior
77    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
78    /// set when configuring the client.
79    pub async fn send(
80        self,
81    ) -> ::std::result::Result<
82        crate::operation::get_shard_iterator::GetShardIteratorOutput,
83        ::aws_smithy_runtime_api::client::result::SdkError<
84            crate::operation::get_shard_iterator::GetShardIteratorError,
85            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
86        >,
87    > {
88        let input = self
89            .inner
90            .build()
91            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
92        let runtime_plugins = crate::operation::get_shard_iterator::GetShardIterator::operation_runtime_plugins(
93            self.handle.runtime_plugins.clone(),
94            &self.handle.conf,
95            self.config_override,
96        );
97        crate::operation::get_shard_iterator::GetShardIterator::orchestrate(&runtime_plugins, input).await
98    }
99
100    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
101    pub fn customize(
102        self,
103    ) -> crate::client::customize::CustomizableOperation<
104        crate::operation::get_shard_iterator::GetShardIteratorOutput,
105        crate::operation::get_shard_iterator::GetShardIteratorError,
106        Self,
107    > {
108        crate::client::customize::CustomizableOperation::new(self)
109    }
110    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
111        self.set_config_override(::std::option::Option::Some(config_override.into()));
112        self
113    }
114
115    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
116        self.config_override = config_override;
117        self
118    }
119    /// <p>The name of the Amazon Kinesis data stream.</p>
120    pub fn stream_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.inner = self.inner.stream_name(input.into());
122        self
123    }
124    /// <p>The name of the Amazon Kinesis data stream.</p>
125    pub fn set_stream_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.inner = self.inner.set_stream_name(input);
127        self
128    }
129    /// <p>The name of the Amazon Kinesis data stream.</p>
130    pub fn get_stream_name(&self) -> &::std::option::Option<::std::string::String> {
131        self.inner.get_stream_name()
132    }
133    /// <p>The shard ID of the Kinesis Data Streams shard to get the iterator for.</p>
134    pub fn shard_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.inner = self.inner.shard_id(input.into());
136        self
137    }
138    /// <p>The shard ID of the Kinesis Data Streams shard to get the iterator for.</p>
139    pub fn set_shard_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_shard_id(input);
141        self
142    }
143    /// <p>The shard ID of the Kinesis Data Streams shard to get the iterator for.</p>
144    pub fn get_shard_id(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_shard_id()
146    }
147    /// <p>Determines how the shard iterator is used to start reading data records from the shard.</p>
148    /// <p>The following are the valid Amazon Kinesis shard iterator types:</p>
149    /// <ul>
150    /// <li>
151    /// <p>AT_SEQUENCE_NUMBER - Start reading from the position denoted by a specific sequence number, provided in the value <code>StartingSequenceNumber</code>.</p></li>
152    /// <li>
153    /// <p>AFTER_SEQUENCE_NUMBER - Start reading right after the position denoted by a specific sequence number, provided in the value <code>StartingSequenceNumber</code>.</p></li>
154    /// <li>
155    /// <p>AT_TIMESTAMP - Start reading from the position denoted by a specific time stamp, provided in the value <code>Timestamp</code>.</p></li>
156    /// <li>
157    /// <p>TRIM_HORIZON - Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.</p></li>
158    /// <li>
159    /// <p>LATEST - Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard.</p></li>
160    /// </ul>
161    pub fn shard_iterator_type(mut self, input: crate::types::ShardIteratorType) -> Self {
162        self.inner = self.inner.shard_iterator_type(input);
163        self
164    }
165    /// <p>Determines how the shard iterator is used to start reading data records from the shard.</p>
166    /// <p>The following are the valid Amazon Kinesis shard iterator types:</p>
167    /// <ul>
168    /// <li>
169    /// <p>AT_SEQUENCE_NUMBER - Start reading from the position denoted by a specific sequence number, provided in the value <code>StartingSequenceNumber</code>.</p></li>
170    /// <li>
171    /// <p>AFTER_SEQUENCE_NUMBER - Start reading right after the position denoted by a specific sequence number, provided in the value <code>StartingSequenceNumber</code>.</p></li>
172    /// <li>
173    /// <p>AT_TIMESTAMP - Start reading from the position denoted by a specific time stamp, provided in the value <code>Timestamp</code>.</p></li>
174    /// <li>
175    /// <p>TRIM_HORIZON - Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.</p></li>
176    /// <li>
177    /// <p>LATEST - Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard.</p></li>
178    /// </ul>
179    pub fn set_shard_iterator_type(mut self, input: ::std::option::Option<crate::types::ShardIteratorType>) -> Self {
180        self.inner = self.inner.set_shard_iterator_type(input);
181        self
182    }
183    /// <p>Determines how the shard iterator is used to start reading data records from the shard.</p>
184    /// <p>The following are the valid Amazon Kinesis shard iterator types:</p>
185    /// <ul>
186    /// <li>
187    /// <p>AT_SEQUENCE_NUMBER - Start reading from the position denoted by a specific sequence number, provided in the value <code>StartingSequenceNumber</code>.</p></li>
188    /// <li>
189    /// <p>AFTER_SEQUENCE_NUMBER - Start reading right after the position denoted by a specific sequence number, provided in the value <code>StartingSequenceNumber</code>.</p></li>
190    /// <li>
191    /// <p>AT_TIMESTAMP - Start reading from the position denoted by a specific time stamp, provided in the value <code>Timestamp</code>.</p></li>
192    /// <li>
193    /// <p>TRIM_HORIZON - Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.</p></li>
194    /// <li>
195    /// <p>LATEST - Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard.</p></li>
196    /// </ul>
197    pub fn get_shard_iterator_type(&self) -> &::std::option::Option<crate::types::ShardIteratorType> {
198        self.inner.get_shard_iterator_type()
199    }
200    /// <p>The sequence number of the data record in the shard from which to start reading. Used with shard iterator type AT_SEQUENCE_NUMBER and AFTER_SEQUENCE_NUMBER.</p>
201    pub fn starting_sequence_number(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
202        self.inner = self.inner.starting_sequence_number(input.into());
203        self
204    }
205    /// <p>The sequence number of the data record in the shard from which to start reading. Used with shard iterator type AT_SEQUENCE_NUMBER and AFTER_SEQUENCE_NUMBER.</p>
206    pub fn set_starting_sequence_number(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
207        self.inner = self.inner.set_starting_sequence_number(input);
208        self
209    }
210    /// <p>The sequence number of the data record in the shard from which to start reading. Used with shard iterator type AT_SEQUENCE_NUMBER and AFTER_SEQUENCE_NUMBER.</p>
211    pub fn get_starting_sequence_number(&self) -> &::std::option::Option<::std::string::String> {
212        self.inner.get_starting_sequence_number()
213    }
214    /// <p>The time stamp of the data record from which to start reading. Used with shard iterator type AT_TIMESTAMP. A time stamp is the Unix epoch date with precision in milliseconds. For example, <code>2016-04-04T19:58:46.480-00:00</code> or <code>1459799926.480</code>. If a record with this exact time stamp does not exist, the iterator returned is for the next (later) record. If the time stamp is older than the current trim horizon, the iterator returned is for the oldest untrimmed data record (TRIM_HORIZON).</p>
215    pub fn timestamp(mut self, input: ::aws_smithy_types::DateTime) -> Self {
216        self.inner = self.inner.timestamp(input);
217        self
218    }
219    /// <p>The time stamp of the data record from which to start reading. Used with shard iterator type AT_TIMESTAMP. A time stamp is the Unix epoch date with precision in milliseconds. For example, <code>2016-04-04T19:58:46.480-00:00</code> or <code>1459799926.480</code>. If a record with this exact time stamp does not exist, the iterator returned is for the next (later) record. If the time stamp is older than the current trim horizon, the iterator returned is for the oldest untrimmed data record (TRIM_HORIZON).</p>
220    pub fn set_timestamp(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
221        self.inner = self.inner.set_timestamp(input);
222        self
223    }
224    /// <p>The time stamp of the data record from which to start reading. Used with shard iterator type AT_TIMESTAMP. A time stamp is the Unix epoch date with precision in milliseconds. For example, <code>2016-04-04T19:58:46.480-00:00</code> or <code>1459799926.480</code>. If a record with this exact time stamp does not exist, the iterator returned is for the next (later) record. If the time stamp is older than the current trim horizon, the iterator returned is for the oldest untrimmed data record (TRIM_HORIZON).</p>
225    pub fn get_timestamp(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
226        self.inner.get_timestamp()
227    }
228    /// <p>The ARN of the stream.</p>
229    pub fn stream_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
230        self.inner = self.inner.stream_arn(input.into());
231        self
232    }
233    /// <p>The ARN of the stream.</p>
234    pub fn set_stream_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
235        self.inner = self.inner.set_stream_arn(input);
236        self
237    }
238    /// <p>The ARN of the stream.</p>
239    pub fn get_stream_arn(&self) -> &::std::option::Option<::std::string::String> {
240        self.inner.get_stream_arn()
241    }
242}