aws_sdk_pipes/types/
_pipe_target_kinesis_stream_parameters.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The parameters for using a Kinesis stream as a target.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
6pub struct PipeTargetKinesisStreamParameters {
7    /// <p>Determines which shard in the stream the data record is assigned to. Partition keys are Unicode strings with a maximum length limit of 256 characters for each key. Amazon Kinesis Data Streams uses the partition key as input to a hash function that maps the partition key and associated data to a specific shard. Specifically, an MD5 hash function is used to map partition keys to 128-bit integer values and to map associated data records to shards. As a result of this hashing mechanism, all data records with the same partition key map to the same shard within the stream.</p>
8    pub partition_key: ::std::string::String,
9}
10impl PipeTargetKinesisStreamParameters {
11    /// <p>Determines which shard in the stream the data record is assigned to. Partition keys are Unicode strings with a maximum length limit of 256 characters for each key. Amazon Kinesis Data Streams uses the partition key as input to a hash function that maps the partition key and associated data to a specific shard. Specifically, an MD5 hash function is used to map partition keys to 128-bit integer values and to map associated data records to shards. As a result of this hashing mechanism, all data records with the same partition key map to the same shard within the stream.</p>
12    pub fn partition_key(&self) -> &str {
13        use std::ops::Deref;
14        self.partition_key.deref()
15    }
16}
17impl ::std::fmt::Debug for PipeTargetKinesisStreamParameters {
18    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
19        let mut formatter = f.debug_struct("PipeTargetKinesisStreamParameters");
20        formatter.field("partition_key", &"*** Sensitive Data Redacted ***");
21        formatter.finish()
22    }
23}
24impl PipeTargetKinesisStreamParameters {
25    /// Creates a new builder-style object to manufacture [`PipeTargetKinesisStreamParameters`](crate::types::PipeTargetKinesisStreamParameters).
26    pub fn builder() -> crate::types::builders::PipeTargetKinesisStreamParametersBuilder {
27        crate::types::builders::PipeTargetKinesisStreamParametersBuilder::default()
28    }
29}
30
31/// A builder for [`PipeTargetKinesisStreamParameters`](crate::types::PipeTargetKinesisStreamParameters).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
33#[non_exhaustive]
34pub struct PipeTargetKinesisStreamParametersBuilder {
35    pub(crate) partition_key: ::std::option::Option<::std::string::String>,
36}
37impl PipeTargetKinesisStreamParametersBuilder {
38    /// <p>Determines which shard in the stream the data record is assigned to. Partition keys are Unicode strings with a maximum length limit of 256 characters for each key. Amazon Kinesis Data Streams uses the partition key as input to a hash function that maps the partition key and associated data to a specific shard. Specifically, an MD5 hash function is used to map partition keys to 128-bit integer values and to map associated data records to shards. As a result of this hashing mechanism, all data records with the same partition key map to the same shard within the stream.</p>
39    /// This field is required.
40    pub fn partition_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.partition_key = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>Determines which shard in the stream the data record is assigned to. Partition keys are Unicode strings with a maximum length limit of 256 characters for each key. Amazon Kinesis Data Streams uses the partition key as input to a hash function that maps the partition key and associated data to a specific shard. Specifically, an MD5 hash function is used to map partition keys to 128-bit integer values and to map associated data records to shards. As a result of this hashing mechanism, all data records with the same partition key map to the same shard within the stream.</p>
45    pub fn set_partition_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.partition_key = input;
47        self
48    }
49    /// <p>Determines which shard in the stream the data record is assigned to. Partition keys are Unicode strings with a maximum length limit of 256 characters for each key. Amazon Kinesis Data Streams uses the partition key as input to a hash function that maps the partition key and associated data to a specific shard. Specifically, an MD5 hash function is used to map partition keys to 128-bit integer values and to map associated data records to shards. As a result of this hashing mechanism, all data records with the same partition key map to the same shard within the stream.</p>
50    pub fn get_partition_key(&self) -> &::std::option::Option<::std::string::String> {
51        &self.partition_key
52    }
53    /// Consumes the builder and constructs a [`PipeTargetKinesisStreamParameters`](crate::types::PipeTargetKinesisStreamParameters).
54    /// This method will fail if any of the following fields are not set:
55    /// - [`partition_key`](crate::types::builders::PipeTargetKinesisStreamParametersBuilder::partition_key)
56    pub fn build(self) -> ::std::result::Result<crate::types::PipeTargetKinesisStreamParameters, ::aws_smithy_types::error::operation::BuildError> {
57        ::std::result::Result::Ok(crate::types::PipeTargetKinesisStreamParameters {
58            partition_key: self.partition_key.ok_or_else(|| {
59                ::aws_smithy_types::error::operation::BuildError::missing_field(
60                    "partition_key",
61                    "partition_key was not specified but it is required when building PipeTargetKinesisStreamParameters",
62                )
63            })?,
64        })
65    }
66}
67impl ::std::fmt::Debug for PipeTargetKinesisStreamParametersBuilder {
68    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
69        let mut formatter = f.debug_struct("PipeTargetKinesisStreamParametersBuilder");
70        formatter.field("partition_key", &"*** Sensitive Data Redacted ***");
71        formatter.finish()
72    }
73}