aws-sdk-deadline 1.100.0

AWS SDK for AWSDeadlineCloud
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 BatchGetSessionOutput {
    /// <p>A list of sessions that were successfully retrieved.</p>
    pub sessions: ::std::vec::Vec<crate::types::BatchGetSessionItem>,
    /// <p>A list of errors for sessions that could not be retrieved.</p>
    pub errors: ::std::vec::Vec<crate::types::BatchGetSessionError>,
    _request_id: Option<String>,
}
impl BatchGetSessionOutput {
    /// <p>A list of sessions that were successfully retrieved.</p>
    pub fn sessions(&self) -> &[crate::types::BatchGetSessionItem] {
        use std::ops::Deref;
        self.sessions.deref()
    }
    /// <p>A list of errors for sessions that could not be retrieved.</p>
    pub fn errors(&self) -> &[crate::types::BatchGetSessionError] {
        use std::ops::Deref;
        self.errors.deref()
    }
}
impl ::aws_types::request_id::RequestId for BatchGetSessionOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl BatchGetSessionOutput {
    /// Creates a new builder-style object to manufacture [`BatchGetSessionOutput`](crate::operation::batch_get_session::BatchGetSessionOutput).
    pub fn builder() -> crate::operation::batch_get_session::builders::BatchGetSessionOutputBuilder {
        crate::operation::batch_get_session::builders::BatchGetSessionOutputBuilder::default()
    }
}

/// A builder for [`BatchGetSessionOutput`](crate::operation::batch_get_session::BatchGetSessionOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct BatchGetSessionOutputBuilder {
    pub(crate) sessions: ::std::option::Option<::std::vec::Vec<crate::types::BatchGetSessionItem>>,
    pub(crate) errors: ::std::option::Option<::std::vec::Vec<crate::types::BatchGetSessionError>>,
    _request_id: Option<String>,
}
impl BatchGetSessionOutputBuilder {
    /// Appends an item to `sessions`.
    ///
    /// To override the contents of this collection use [`set_sessions`](Self::set_sessions).
    ///
    /// <p>A list of sessions that were successfully retrieved.</p>
    pub fn sessions(mut self, input: crate::types::BatchGetSessionItem) -> Self {
        let mut v = self.sessions.unwrap_or_default();
        v.push(input);
        self.sessions = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of sessions that were successfully retrieved.</p>
    pub fn set_sessions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::BatchGetSessionItem>>) -> Self {
        self.sessions = input;
        self
    }
    /// <p>A list of sessions that were successfully retrieved.</p>
    pub fn get_sessions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::BatchGetSessionItem>> {
        &self.sessions
    }
    /// Appends an item to `errors`.
    ///
    /// To override the contents of this collection use [`set_errors`](Self::set_errors).
    ///
    /// <p>A list of errors for sessions that could not be retrieved.</p>
    pub fn errors(mut self, input: crate::types::BatchGetSessionError) -> Self {
        let mut v = self.errors.unwrap_or_default();
        v.push(input);
        self.errors = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of errors for sessions that could not be retrieved.</p>
    pub fn set_errors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::BatchGetSessionError>>) -> Self {
        self.errors = input;
        self
    }
    /// <p>A list of errors for sessions that could not be retrieved.</p>
    pub fn get_errors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::BatchGetSessionError>> {
        &self.errors
    }
    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 [`BatchGetSessionOutput`](crate::operation::batch_get_session::BatchGetSessionOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`sessions`](crate::operation::batch_get_session::builders::BatchGetSessionOutputBuilder::sessions)
    /// - [`errors`](crate::operation::batch_get_session::builders::BatchGetSessionOutputBuilder::errors)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::batch_get_session::BatchGetSessionOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::batch_get_session::BatchGetSessionOutput {
            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 BatchGetSessionOutput",
                )
            })?,
            errors: self.errors.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "errors",
                    "errors was not specified but it is required when building BatchGetSessionOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}