aws-sdk-keyspacesstreams 1.25.0

AWS SDK for Amazon Keyspaces Streams
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Represents a uniquely identified group of change records within a change data capture stream for Amazon Keyspaces.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Shard {
    /// <p>A unique identifier for this shard within the stream.</p>
    pub shard_id: ::std::option::Option<::std::string::String>,
    /// <p>The range of sequence numbers contained within this shard.</p>
    pub sequence_number_range: ::std::option::Option<crate::types::SequenceNumberRange>,
    /// <p>The identifiers of parent shards that this shard evolved from, if this shard was created through resharding.</p>
    pub parent_shard_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl Shard {
    /// <p>A unique identifier for this shard within the stream.</p>
    pub fn shard_id(&self) -> ::std::option::Option<&str> {
        self.shard_id.as_deref()
    }
    /// <p>The range of sequence numbers contained within this shard.</p>
    pub fn sequence_number_range(&self) -> ::std::option::Option<&crate::types::SequenceNumberRange> {
        self.sequence_number_range.as_ref()
    }
    /// <p>The identifiers of parent shards that this shard evolved from, if this shard was created through resharding.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.parent_shard_ids.is_none()`.
    pub fn parent_shard_ids(&self) -> &[::std::string::String] {
        self.parent_shard_ids.as_deref().unwrap_or_default()
    }
}
impl Shard {
    /// Creates a new builder-style object to manufacture [`Shard`](crate::types::Shard).
    pub fn builder() -> crate::types::builders::ShardBuilder {
        crate::types::builders::ShardBuilder::default()
    }
}

/// A builder for [`Shard`](crate::types::Shard).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ShardBuilder {
    pub(crate) shard_id: ::std::option::Option<::std::string::String>,
    pub(crate) sequence_number_range: ::std::option::Option<crate::types::SequenceNumberRange>,
    pub(crate) parent_shard_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl ShardBuilder {
    /// <p>A unique identifier for this shard within the stream.</p>
    pub fn shard_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.shard_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A unique identifier for this shard within the stream.</p>
    pub fn set_shard_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.shard_id = input;
        self
    }
    /// <p>A unique identifier for this shard within the stream.</p>
    pub fn get_shard_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.shard_id
    }
    /// <p>The range of sequence numbers contained within this shard.</p>
    pub fn sequence_number_range(mut self, input: crate::types::SequenceNumberRange) -> Self {
        self.sequence_number_range = ::std::option::Option::Some(input);
        self
    }
    /// <p>The range of sequence numbers contained within this shard.</p>
    pub fn set_sequence_number_range(mut self, input: ::std::option::Option<crate::types::SequenceNumberRange>) -> Self {
        self.sequence_number_range = input;
        self
    }
    /// <p>The range of sequence numbers contained within this shard.</p>
    pub fn get_sequence_number_range(&self) -> &::std::option::Option<crate::types::SequenceNumberRange> {
        &self.sequence_number_range
    }
    /// Appends an item to `parent_shard_ids`.
    ///
    /// To override the contents of this collection use [`set_parent_shard_ids`](Self::set_parent_shard_ids).
    ///
    /// <p>The identifiers of parent shards that this shard evolved from, if this shard was created through resharding.</p>
    pub fn parent_shard_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.parent_shard_ids.unwrap_or_default();
        v.push(input.into());
        self.parent_shard_ids = ::std::option::Option::Some(v);
        self
    }
    /// <p>The identifiers of parent shards that this shard evolved from, if this shard was created through resharding.</p>
    pub fn set_parent_shard_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.parent_shard_ids = input;
        self
    }
    /// <p>The identifiers of parent shards that this shard evolved from, if this shard was created through resharding.</p>
    pub fn get_parent_shard_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.parent_shard_ids
    }
    /// Consumes the builder and constructs a [`Shard`](crate::types::Shard).
    pub fn build(self) -> crate::types::Shard {
        crate::types::Shard {
            shard_id: self.shard_id,
            sequence_number_range: self.sequence_number_range,
            parent_shard_ids: self.parent_shard_ids,
        }
    }
}