Struct aws_sdk_kinesis::client::Client

source ·
pub struct Client { /* private fields */ }
Expand description

Client for Amazon Kinesis

Client for invoking operations on Amazon Kinesis. Each operation on Amazon Kinesis is a method on this this struct. .send() MUST be invoked on the generated operations to dispatch the request to the service.

§Constructing a Client

A Config is required to construct a client. For most use cases, the aws-config crate should be used to automatically resolve this config using aws_config::load_from_env(), since this will resolve an SdkConfig which can be shared across multiple different AWS SDK clients. This config resolution process can be customized by calling aws_config::from_env() instead, which returns a ConfigLoader that uses the builder pattern to customize the default config.

In the simplest case, creating a client looks as follows:

let config = aws_config::load_from_env().await;
let client = aws_sdk_kinesis::Client::new(&config);

Occasionally, SDKs may have additional service-specific values that can be set on the Config that is absent from SdkConfig, or slightly different settings for a specific client may be desired. The Config struct implements From<&SdkConfig>, so setting these specific settings can be done as follows:

let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_kinesis::config::Builder::from(&sdk_config)
    .some_service_specific_setting("value")
    .build();

See the aws-config docs and Config for more information on customizing configuration.

Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.

§Using the Client

A client has a function for every operation that can be performed by the service. For example, the AddTagsToStream operation has a Client::add_tags_to_stream, function which returns a builder for that operation. The fluent builder ultimately has a send() function that returns an async future that returns a result, as illustrated below:

let result = client.add_tags_to_stream()
    .stream_name("example")
    .send()
    .await;

The underlying HTTP requests that get made by this can be modified with the customize_operation function on the fluent builder. See the customize module for more information.

Implementations§

source§

impl Client

source

pub fn add_tags_to_stream(&self) -> AddTagsToStreamFluentBuilder

Constructs a fluent builder for the AddTagsToStream operation.

source§

impl Client

source

pub fn create_stream(&self) -> CreateStreamFluentBuilder

Constructs a fluent builder for the CreateStream operation.

source§

impl Client

source

pub fn decrease_stream_retention_period( &self ) -> DecreaseStreamRetentionPeriodFluentBuilder

Constructs a fluent builder for the DecreaseStreamRetentionPeriod operation.

source§

impl Client

source

pub fn delete_resource_policy(&self) -> DeleteResourcePolicyFluentBuilder

Constructs a fluent builder for the DeleteResourcePolicy operation.

source§

impl Client

source

pub fn delete_stream(&self) -> DeleteStreamFluentBuilder

Constructs a fluent builder for the DeleteStream operation.

source§

impl Client

source

pub fn deregister_stream_consumer( &self ) -> DeregisterStreamConsumerFluentBuilder

Constructs a fluent builder for the DeregisterStreamConsumer operation.

source§

impl Client

source

pub fn describe_limits(&self) -> DescribeLimitsFluentBuilder

Constructs a fluent builder for the DescribeLimits operation.

source§

impl Client

source

pub fn describe_stream(&self) -> DescribeStreamFluentBuilder

Constructs a fluent builder for the DescribeStream operation.

source§

impl Client

source

pub fn describe_stream_consumer(&self) -> DescribeStreamConsumerFluentBuilder

Constructs a fluent builder for the DescribeStreamConsumer operation.

source§

impl Client

source

pub fn describe_stream_summary(&self) -> DescribeStreamSummaryFluentBuilder

Constructs a fluent builder for the DescribeStreamSummary operation.

source§

impl Client

source

pub fn disable_enhanced_monitoring( &self ) -> DisableEnhancedMonitoringFluentBuilder

Constructs a fluent builder for the DisableEnhancedMonitoring operation.

source§

impl Client

source

pub fn enable_enhanced_monitoring( &self ) -> EnableEnhancedMonitoringFluentBuilder

Constructs a fluent builder for the EnableEnhancedMonitoring operation.

source§

impl Client

source

pub fn get_records(&self) -> GetRecordsFluentBuilder

Constructs a fluent builder for the GetRecords operation.

source§

impl Client

source

pub fn get_resource_policy(&self) -> GetResourcePolicyFluentBuilder

Constructs a fluent builder for the GetResourcePolicy operation.

source§

impl Client

source

pub fn get_shard_iterator(&self) -> GetShardIteratorFluentBuilder

Constructs a fluent builder for the GetShardIterator operation.

  • The fluent builder is configurable:
    • stream_name(impl Into<String>) / set_stream_name(Option<String>):
      required: false

      The name of the Amazon Kinesis data stream.


    • shard_id(impl Into<String>) / set_shard_id(Option<String>):
      required: true

      The shard ID of the Kinesis Data Streams shard to get the iterator for.


    • shard_iterator_type(ShardIteratorType) / set_shard_iterator_type(Option<ShardIteratorType>):
      required: true

      Determines how the shard iterator is used to start reading data records from the shard.

      The following are the valid Amazon Kinesis shard iterator types:

      • AT_SEQUENCE_NUMBER - Start reading from the position denoted by a specific sequence number, provided in the value StartingSequenceNumber.

      • AFTER_SEQUENCE_NUMBER - Start reading right after the position denoted by a specific sequence number, provided in the value StartingSequenceNumber.

      • AT_TIMESTAMP - Start reading from the position denoted by a specific time stamp, provided in the value Timestamp.

      • TRIM_HORIZON - Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.

      • LATEST - Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard.


    • starting_sequence_number(impl Into<String>) / set_starting_sequence_number(Option<String>):
      required: false

      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.


    • timestamp(DateTime) / set_timestamp(Option<DateTime>):
      required: false

      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, 2016-04-04T19:58:46.480-00:00 or 1459799926.480. 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).


    • stream_arn(impl Into<String>) / set_stream_arn(Option<String>):
      required: false

      The ARN of the stream.


  • On success, responds with GetShardIteratorOutput with field(s):
    • shard_iterator(Option<String>):

      The position in the shard from which to start reading data records sequentially. A shard iterator specifies this position using the sequence number of a data record in a shard.

  • On failure, responds with SdkError<GetShardIteratorError>
source§

impl Client

source

pub fn increase_stream_retention_period( &self ) -> IncreaseStreamRetentionPeriodFluentBuilder

Constructs a fluent builder for the IncreaseStreamRetentionPeriod operation.

source§

impl Client

source

pub fn list_shards(&self) -> ListShardsFluentBuilder

Constructs a fluent builder for the ListShards operation.

  • The fluent builder is configurable:
    • stream_name(impl Into<String>) / set_stream_name(Option<String>):
      required: false

      The name of the data stream whose shards you want to list.

      You cannot specify this parameter if you specify the NextToken parameter.


    • next_token(impl Into<String>) / set_next_token(Option<String>):
      required: false

      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.


    • exclusive_start_shard_id(impl Into<String>) / set_exclusive_start_shard_id(Option<String>):
      required: false

      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.


    • max_results(i32) / set_max_results(Option<i32>):
      required: false

      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.


    • stream_creation_timestamp(DateTime) / set_stream_creation_timestamp(Option<DateTime>):
      required: false

      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.


    • shard_filter(ShardFilter) / set_shard_filter(Option<ShardFilter>):
      required: false

      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.


    • stream_arn(impl Into<String>) / set_stream_arn(Option<String>):
      required: false

      The ARN of the stream.


  • On success, responds with ListShardsOutput with field(s):
    • shards(Option<Vec::<Shard>>):

      An array of JSON objects. Each object represents one shard and specifies the IDs of the shard, the shard’s parent, and the shard that’s adjacent to the shard’s parent. Each object also contains the starting and ending hash keys and the starting and ending sequence numbers for the shard.

    • next_token(Option<String>):

      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. For more information about the use of this pagination token when calling the ListShards operation, see ListShardsInput$NextToken.

      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.

  • On failure, responds with SdkError<ListShardsError>
source§

impl Client

source

pub fn list_stream_consumers(&self) -> ListStreamConsumersFluentBuilder

Constructs a fluent builder for the ListStreamConsumers operation. This operation supports pagination; See into_paginator().

  • The fluent builder is configurable:
    • stream_arn(impl Into<String>) / set_stream_arn(Option<String>):
      required: true

      The ARN of the Kinesis data stream for which you want to list the registered consumers. For more information, see Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces.


    • next_token(impl Into<String>) / set_next_token(Option<String>):
      required: false

      When the number of consumers that are registered with 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 consumers that are registered with the data stream, the response includes a pagination token named NextToken. You can specify this NextToken value in a subsequent call to ListStreamConsumers to list the next set of registered consumers.

      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 consumers 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 ListStreamConsumers operation to list the next set of consumers.

      Tokens expire after 300 seconds. When you obtain a value for NextToken in the response to a call to ListStreamConsumers, you have 300 seconds to use that value. If you specify an expired token in a call to ListStreamConsumers, you get ExpiredNextTokenException.


    • max_results(i32) / set_max_results(Option<i32>):
      required: false

      The maximum number of consumers that you want a single call of ListStreamConsumers to return. The default value is 100. If you specify a value greater than 100, at most 100 results are returned.


    • stream_creation_timestamp(DateTime) / set_stream_creation_timestamp(Option<DateTime>):
      required: false

      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 consumers for.

      You can’t specify this parameter if you specify the NextToken parameter.


  • On success, responds with ListStreamConsumersOutput with field(s):
    • consumers(Option<Vec::<Consumer>>):

      An array of JSON objects. Each object represents one registered consumer.

    • next_token(Option<String>):

      When the number of consumers that are registered with 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 registered consumers, the response includes a pagination token named NextToken. You can specify this NextToken value in a subsequent call to ListStreamConsumers to list the next set of registered consumers. For more information about the use of this pagination token when calling the ListStreamConsumers operation, see ListStreamConsumersInput$NextToken.

      Tokens expire after 300 seconds. When you obtain a value for NextToken in the response to a call to ListStreamConsumers, you have 300 seconds to use that value. If you specify an expired token in a call to ListStreamConsumers, you get ExpiredNextTokenException.

  • On failure, responds with SdkError<ListStreamConsumersError>
source§

impl Client

source

pub fn list_streams(&self) -> ListStreamsFluentBuilder

Constructs a fluent builder for the ListStreams operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn list_tags_for_stream(&self) -> ListTagsForStreamFluentBuilder

Constructs a fluent builder for the ListTagsForStream operation.

source§

impl Client

source

pub fn merge_shards(&self) -> MergeShardsFluentBuilder

Constructs a fluent builder for the MergeShards operation.

source§

impl Client

source

pub fn put_record(&self) -> PutRecordFluentBuilder

Constructs a fluent builder for the PutRecord operation.

  • The fluent builder is configurable:
  • On success, responds with PutRecordOutput with field(s):
    • shard_id(String):

      The shard ID of the shard where the data record was placed.

    • sequence_number(String):

      The sequence number identifier that was assigned to the put data record. The sequence number for the record is unique across all records in the stream. A sequence number is the identifier associated with every record put into the stream.

    • encryption_type(Option<EncryptionType>):

      The encryption type to use on the record. This parameter can be one of the following values:

      • NONE: Do not encrypt the records in the stream.

      • KMS: Use server-side encryption on the records in the stream using a customer-managed Amazon Web Services KMS key.

  • On failure, responds with SdkError<PutRecordError>
source§

impl Client

source

pub fn put_records(&self) -> PutRecordsFluentBuilder

Constructs a fluent builder for the PutRecords operation.

source§

impl Client

source

pub fn put_resource_policy(&self) -> PutResourcePolicyFluentBuilder

Constructs a fluent builder for the PutResourcePolicy operation.

source§

impl Client

source

pub fn register_stream_consumer(&self) -> RegisterStreamConsumerFluentBuilder

Constructs a fluent builder for the RegisterStreamConsumer operation.

source§

impl Client

source

pub fn remove_tags_from_stream(&self) -> RemoveTagsFromStreamFluentBuilder

Constructs a fluent builder for the RemoveTagsFromStream operation.

source§

impl Client

source

pub fn split_shard(&self) -> SplitShardFluentBuilder

Constructs a fluent builder for the SplitShard operation.

source§

impl Client

source

pub fn start_stream_encryption(&self) -> StartStreamEncryptionFluentBuilder

Constructs a fluent builder for the StartStreamEncryption operation.

source§

impl Client

source

pub fn stop_stream_encryption(&self) -> StopStreamEncryptionFluentBuilder

Constructs a fluent builder for the StopStreamEncryption operation.

source§

impl Client

source

pub fn update_shard_count(&self) -> UpdateShardCountFluentBuilder

Constructs a fluent builder for the UpdateShardCount operation.

source§

impl Client

source

pub fn update_stream_mode(&self) -> UpdateStreamModeFluentBuilder

Constructs a fluent builder for the UpdateStreamMode operation.

source§

impl Client

source

pub fn from_conf(conf: Config) -> Self

Creates a new client from the service Config.

§Panics

This method will panic in the following cases:

  • Retries or timeouts are enabled without a sleep_impl configured.
  • Identity caching is enabled without a sleep_impl and time_source configured.
  • No behavior_version is provided.

The panic message for each of these will have instructions on how to resolve them.

source

pub fn config(&self) -> &Config

Returns the client’s configuration.

source§

impl Client

source

pub fn new(sdk_config: &SdkConfig) -> Self

Creates a new client from an SDK Config.

§Panics
  • This method will panic if the sdk_config is missing an async sleep implementation. If you experience this panic, set the sleep_impl on the Config passed into this function to fix it.
  • This method will panic if the sdk_config is missing an HTTP connector. If you experience this panic, set the http_connector on the Config passed into this function to fix it.
  • This method will panic if no BehaviorVersion is provided. If you experience this panic, set behavior_version on the Config or enable the behavior-version-latest Cargo feature.

Trait Implementations§

source§

impl Clone for Client

source§

fn clone(&self) -> Client

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Client

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more