aws-sdk-iottwinmaker 1.101.0

AWS SDK for AWS IoT TwinMaker
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 ListComponentsOutput {
    /// <p>A list of objects that contain information about the components.</p>
    pub component_summaries: ::std::vec::Vec<crate::types::ComponentSummary>,
    /// <p>The string that specifies the next page of component results.</p>
    pub next_token: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl ListComponentsOutput {
    /// <p>A list of objects that contain information about the components.</p>
    pub fn component_summaries(&self) -> &[crate::types::ComponentSummary] {
        use std::ops::Deref;
        self.component_summaries.deref()
    }
    /// <p>The string that specifies the next page of component results.</p>
    pub fn next_token(&self) -> ::std::option::Option<&str> {
        self.next_token.as_deref()
    }
}
impl ::aws_types::request_id::RequestId for ListComponentsOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl ListComponentsOutput {
    /// Creates a new builder-style object to manufacture [`ListComponentsOutput`](crate::operation::list_components::ListComponentsOutput).
    pub fn builder() -> crate::operation::list_components::builders::ListComponentsOutputBuilder {
        crate::operation::list_components::builders::ListComponentsOutputBuilder::default()
    }
}

/// A builder for [`ListComponentsOutput`](crate::operation::list_components::ListComponentsOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ListComponentsOutputBuilder {
    pub(crate) component_summaries: ::std::option::Option<::std::vec::Vec<crate::types::ComponentSummary>>,
    pub(crate) next_token: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl ListComponentsOutputBuilder {
    /// Appends an item to `component_summaries`.
    ///
    /// To override the contents of this collection use [`set_component_summaries`](Self::set_component_summaries).
    ///
    /// <p>A list of objects that contain information about the components.</p>
    pub fn component_summaries(mut self, input: crate::types::ComponentSummary) -> Self {
        let mut v = self.component_summaries.unwrap_or_default();
        v.push(input);
        self.component_summaries = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of objects that contain information about the components.</p>
    pub fn set_component_summaries(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ComponentSummary>>) -> Self {
        self.component_summaries = input;
        self
    }
    /// <p>A list of objects that contain information about the components.</p>
    pub fn get_component_summaries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ComponentSummary>> {
        &self.component_summaries
    }
    /// <p>The string that specifies the next page of component results.</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>The string that specifies the next page of component results.</p>
    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.next_token = input;
        self
    }
    /// <p>The string that specifies the next page of component results.</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 [`ListComponentsOutput`](crate::operation::list_components::ListComponentsOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`component_summaries`](crate::operation::list_components::builders::ListComponentsOutputBuilder::component_summaries)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::list_components::ListComponentsOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::list_components::ListComponentsOutput {
            component_summaries: self.component_summaries.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "component_summaries",
                    "component_summaries was not specified but it is required when building ListComponentsOutput",
                )
            })?,
            next_token: self.next_token,
            _request_id: self._request_id,
        })
    }
}