aws-sdk-redshiftdata 1.111.0

AWS SDK for Redshift Data API Service
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 ListSessionsOutput {
    /// <p>The sessions that match the request.</p>
    pub sessions: ::std::vec::Vec<crate::types::SessionData>,
    /// <p>A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.</p>
    pub next_token: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl ListSessionsOutput {
    /// <p>The sessions that match the request.</p>
    pub fn sessions(&self) -> &[crate::types::SessionData] {
        use std::ops::Deref;
        self.sessions.deref()
    }
    /// <p>A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.</p>
    pub fn next_token(&self) -> ::std::option::Option<&str> {
        self.next_token.as_deref()
    }
}
impl ::aws_types::request_id::RequestId for ListSessionsOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl ListSessionsOutput {
    /// Creates a new builder-style object to manufacture [`ListSessionsOutput`](crate::operation::list_sessions::ListSessionsOutput).
    pub fn builder() -> crate::operation::list_sessions::builders::ListSessionsOutputBuilder {
        crate::operation::list_sessions::builders::ListSessionsOutputBuilder::default()
    }
}

/// A builder for [`ListSessionsOutput`](crate::operation::list_sessions::ListSessionsOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ListSessionsOutputBuilder {
    pub(crate) sessions: ::std::option::Option<::std::vec::Vec<crate::types::SessionData>>,
    pub(crate) next_token: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl ListSessionsOutputBuilder {
    /// Appends an item to `sessions`.
    ///
    /// To override the contents of this collection use [`set_sessions`](Self::set_sessions).
    ///
    /// <p>The sessions that match the request.</p>
    pub fn sessions(mut self, input: crate::types::SessionData) -> Self {
        let mut v = self.sessions.unwrap_or_default();
        v.push(input);
        self.sessions = ::std::option::Option::Some(v);
        self
    }
    /// <p>The sessions that match the request.</p>
    pub fn set_sessions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SessionData>>) -> Self {
        self.sessions = input;
        self
    }
    /// <p>The sessions that match the request.</p>
    pub fn get_sessions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SessionData>> {
        &self.sessions
    }
    /// <p>A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.</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 value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.</p>
    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.next_token = input;
        self
    }
    /// <p>A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.</p>
    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.next_token
    }
    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 [`ListSessionsOutput`](crate::operation::list_sessions::ListSessionsOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`sessions`](crate::operation::list_sessions::builders::ListSessionsOutputBuilder::sessions)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::list_sessions::ListSessionsOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::list_sessions::ListSessionsOutput {
            sessions: self.sessions.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "sessions",
                    "sessions was not specified but it is required when building ListSessionsOutput",
                )
            })?,
            next_token: self.next_token,
            _request_id: self._request_id,
        })
    }
}