aws-sdk-keyspaces 1.104.0

AWS SDK for Amazon Keyspaces
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct ListKeyspacesOutput {
    /// <p>A token to specify where to start paginating. This is the <code>NextToken</code> from a previously truncated response.</p>
    pub next_token: ::std::option::Option<::std::string::String>,
    /// <p>A list of keyspaces.</p>
    pub keyspaces: ::std::vec::Vec<crate::types::KeyspaceSummary>,
    _request_id: Option<String>,
}
impl ListKeyspacesOutput {
    /// <p>A token to specify where to start paginating. This is the <code>NextToken</code> from a previously truncated response.</p>
    pub fn next_token(&self) -> ::std::option::Option<&str> {
        self.next_token.as_deref()
    }
    /// <p>A list of keyspaces.</p>
    pub fn keyspaces(&self) -> &[crate::types::KeyspaceSummary] {
        use std::ops::Deref;
        self.keyspaces.deref()
    }
}
impl ::aws_types::request_id::RequestId for ListKeyspacesOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl ListKeyspacesOutput {
    /// Creates a new builder-style object to manufacture [`ListKeyspacesOutput`](crate::operation::list_keyspaces::ListKeyspacesOutput).
    pub fn builder() -> crate::operation::list_keyspaces::builders::ListKeyspacesOutputBuilder {
        crate::operation::list_keyspaces::builders::ListKeyspacesOutputBuilder::default()
    }
}

/// A builder for [`ListKeyspacesOutput`](crate::operation::list_keyspaces::ListKeyspacesOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ListKeyspacesOutputBuilder {
    pub(crate) next_token: ::std::option::Option<::std::string::String>,
    pub(crate) keyspaces: ::std::option::Option<::std::vec::Vec<crate::types::KeyspaceSummary>>,
    _request_id: Option<String>,
}
impl ListKeyspacesOutputBuilder {
    /// <p>A token to specify where to start paginating. This is the <code>NextToken</code> from a previously truncated response.</p>
    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.next_token = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A token to specify where to start paginating. This is the <code>NextToken</code> from a previously truncated response.</p>
    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.next_token = input;
        self
    }
    /// <p>A token to specify where to start paginating. This is the <code>NextToken</code> from a previously truncated response.</p>
    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.next_token
    }
    /// Appends an item to `keyspaces`.
    ///
    /// To override the contents of this collection use [`set_keyspaces`](Self::set_keyspaces).
    ///
    /// <p>A list of keyspaces.</p>
    pub fn keyspaces(mut self, input: crate::types::KeyspaceSummary) -> Self {
        let mut v = self.keyspaces.unwrap_or_default();
        v.push(input);
        self.keyspaces = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of keyspaces.</p>
    pub fn set_keyspaces(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::KeyspaceSummary>>) -> Self {
        self.keyspaces = input;
        self
    }
    /// <p>A list of keyspaces.</p>
    pub fn get_keyspaces(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::KeyspaceSummary>> {
        &self.keyspaces
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`ListKeyspacesOutput`](crate::operation::list_keyspaces::ListKeyspacesOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`keyspaces`](crate::operation::list_keyspaces::builders::ListKeyspacesOutputBuilder::keyspaces)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::list_keyspaces::ListKeyspacesOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::list_keyspaces::ListKeyspacesOutput {
            next_token: self.next_token,
            keyspaces: self.keyspaces.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "keyspaces",
                    "keyspaces was not specified but it is required when building ListKeyspacesOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}