aws_sdk_apigateway/operation/get_models/
_get_models_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents a collection of Model resources.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct GetModelsOutput {
7    /// <p>The current page of elements from this collection.</p>
8    pub items: ::std::option::Option<::std::vec::Vec<crate::types::Model>>,
9    /// <p>The current pagination position in the paged result set.</p>
10    pub position: ::std::option::Option<::std::string::String>,
11    _request_id: Option<String>,
12}
13impl GetModelsOutput {
14    /// <p>The current page of elements from this collection.</p>
15    ///
16    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.items.is_none()`.
17    pub fn items(&self) -> &[crate::types::Model] {
18        self.items.as_deref().unwrap_or_default()
19    }
20    /// <p>The current pagination position in the paged result set.</p>
21    pub fn position(&self) -> ::std::option::Option<&str> {
22        self.position.as_deref()
23    }
24}
25impl ::aws_types::request_id::RequestId for GetModelsOutput {
26    fn request_id(&self) -> Option<&str> {
27        self._request_id.as_deref()
28    }
29}
30impl GetModelsOutput {
31    /// Creates a new builder-style object to manufacture [`GetModelsOutput`](crate::operation::get_models::GetModelsOutput).
32    pub fn builder() -> crate::operation::get_models::builders::GetModelsOutputBuilder {
33        crate::operation::get_models::builders::GetModelsOutputBuilder::default()
34    }
35}
36
37/// A builder for [`GetModelsOutput`](crate::operation::get_models::GetModelsOutput).
38#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct GetModelsOutputBuilder {
41    pub(crate) items: ::std::option::Option<::std::vec::Vec<crate::types::Model>>,
42    pub(crate) position: ::std::option::Option<::std::string::String>,
43    _request_id: Option<String>,
44}
45impl GetModelsOutputBuilder {
46    /// Appends an item to `items`.
47    ///
48    /// To override the contents of this collection use [`set_items`](Self::set_items).
49    ///
50    /// <p>The current page of elements from this collection.</p>
51    pub fn items(mut self, input: crate::types::Model) -> Self {
52        let mut v = self.items.unwrap_or_default();
53        v.push(input);
54        self.items = ::std::option::Option::Some(v);
55        self
56    }
57    /// <p>The current page of elements from this collection.</p>
58    pub fn set_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Model>>) -> Self {
59        self.items = input;
60        self
61    }
62    /// <p>The current page of elements from this collection.</p>
63    pub fn get_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Model>> {
64        &self.items
65    }
66    /// <p>The current pagination position in the paged result set.</p>
67    pub fn position(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68        self.position = ::std::option::Option::Some(input.into());
69        self
70    }
71    /// <p>The current pagination position in the paged result set.</p>
72    pub fn set_position(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
73        self.position = input;
74        self
75    }
76    /// <p>The current pagination position in the paged result set.</p>
77    pub fn get_position(&self) -> &::std::option::Option<::std::string::String> {
78        &self.position
79    }
80    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
81        self._request_id = Some(request_id.into());
82        self
83    }
84
85    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
86        self._request_id = request_id;
87        self
88    }
89    /// Consumes the builder and constructs a [`GetModelsOutput`](crate::operation::get_models::GetModelsOutput).
90    pub fn build(self) -> crate::operation::get_models::GetModelsOutput {
91        crate::operation::get_models::GetModelsOutput {
92            items: self.items,
93            position: self.position,
94            _request_id: self._request_id,
95        }
96    }
97}