aws_sdk_iam/operation/get_group/
_get_group_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains the response to a successful <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetGroup.html">GetGroup</a> request.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct GetGroupOutput {
7    /// <p>A structure that contains details about the group.</p>
8    pub group: ::std::option::Option<crate::types::Group>,
9    /// <p>A list of users in the group.</p>
10    pub users: ::std::vec::Vec<crate::types::User>,
11    /// <p>A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the <code>Marker</code> request parameter to retrieve more items. Note that IAM might return fewer than the <code>MaxItems</code> number of results even when there are more results available. We recommend that you check <code>IsTruncated</code> after every call to ensure that you receive all your results.</p>
12    pub is_truncated: bool,
13    /// <p>When <code>IsTruncated</code> is <code>true</code>, this element is present and contains the value to use for the <code>Marker</code> parameter in a subsequent pagination request.</p>
14    pub marker: ::std::option::Option<::std::string::String>,
15    _request_id: Option<String>,
16}
17impl GetGroupOutput {
18    /// <p>A structure that contains details about the group.</p>
19    pub fn group(&self) -> ::std::option::Option<&crate::types::Group> {
20        self.group.as_ref()
21    }
22    /// <p>A list of users in the group.</p>
23    pub fn users(&self) -> &[crate::types::User] {
24        use std::ops::Deref;
25        self.users.deref()
26    }
27    /// <p>A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the <code>Marker</code> request parameter to retrieve more items. Note that IAM might return fewer than the <code>MaxItems</code> number of results even when there are more results available. We recommend that you check <code>IsTruncated</code> after every call to ensure that you receive all your results.</p>
28    pub fn is_truncated(&self) -> bool {
29        self.is_truncated
30    }
31    /// <p>When <code>IsTruncated</code> is <code>true</code>, this element is present and contains the value to use for the <code>Marker</code> parameter in a subsequent pagination request.</p>
32    pub fn marker(&self) -> ::std::option::Option<&str> {
33        self.marker.as_deref()
34    }
35}
36impl ::aws_types::request_id::RequestId for GetGroupOutput {
37    fn request_id(&self) -> Option<&str> {
38        self._request_id.as_deref()
39    }
40}
41impl GetGroupOutput {
42    /// Creates a new builder-style object to manufacture [`GetGroupOutput`](crate::operation::get_group::GetGroupOutput).
43    pub fn builder() -> crate::operation::get_group::builders::GetGroupOutputBuilder {
44        crate::operation::get_group::builders::GetGroupOutputBuilder::default()
45    }
46}
47
48/// A builder for [`GetGroupOutput`](crate::operation::get_group::GetGroupOutput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct GetGroupOutputBuilder {
52    pub(crate) group: ::std::option::Option<crate::types::Group>,
53    pub(crate) users: ::std::option::Option<::std::vec::Vec<crate::types::User>>,
54    pub(crate) is_truncated: ::std::option::Option<bool>,
55    pub(crate) marker: ::std::option::Option<::std::string::String>,
56    _request_id: Option<String>,
57}
58impl GetGroupOutputBuilder {
59    /// <p>A structure that contains details about the group.</p>
60    /// This field is required.
61    pub fn group(mut self, input: crate::types::Group) -> Self {
62        self.group = ::std::option::Option::Some(input);
63        self
64    }
65    /// <p>A structure that contains details about the group.</p>
66    pub fn set_group(mut self, input: ::std::option::Option<crate::types::Group>) -> Self {
67        self.group = input;
68        self
69    }
70    /// <p>A structure that contains details about the group.</p>
71    pub fn get_group(&self) -> &::std::option::Option<crate::types::Group> {
72        &self.group
73    }
74    /// Appends an item to `users`.
75    ///
76    /// To override the contents of this collection use [`set_users`](Self::set_users).
77    ///
78    /// <p>A list of users in the group.</p>
79    pub fn users(mut self, input: crate::types::User) -> Self {
80        let mut v = self.users.unwrap_or_default();
81        v.push(input);
82        self.users = ::std::option::Option::Some(v);
83        self
84    }
85    /// <p>A list of users in the group.</p>
86    pub fn set_users(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::User>>) -> Self {
87        self.users = input;
88        self
89    }
90    /// <p>A list of users in the group.</p>
91    pub fn get_users(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::User>> {
92        &self.users
93    }
94    /// <p>A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the <code>Marker</code> request parameter to retrieve more items. Note that IAM might return fewer than the <code>MaxItems</code> number of results even when there are more results available. We recommend that you check <code>IsTruncated</code> after every call to ensure that you receive all your results.</p>
95    pub fn is_truncated(mut self, input: bool) -> Self {
96        self.is_truncated = ::std::option::Option::Some(input);
97        self
98    }
99    /// <p>A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the <code>Marker</code> request parameter to retrieve more items. Note that IAM might return fewer than the <code>MaxItems</code> number of results even when there are more results available. We recommend that you check <code>IsTruncated</code> after every call to ensure that you receive all your results.</p>
100    pub fn set_is_truncated(mut self, input: ::std::option::Option<bool>) -> Self {
101        self.is_truncated = input;
102        self
103    }
104    /// <p>A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the <code>Marker</code> request parameter to retrieve more items. Note that IAM might return fewer than the <code>MaxItems</code> number of results even when there are more results available. We recommend that you check <code>IsTruncated</code> after every call to ensure that you receive all your results.</p>
105    pub fn get_is_truncated(&self) -> &::std::option::Option<bool> {
106        &self.is_truncated
107    }
108    /// <p>When <code>IsTruncated</code> is <code>true</code>, this element is present and contains the value to use for the <code>Marker</code> parameter in a subsequent pagination request.</p>
109    pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
110        self.marker = ::std::option::Option::Some(input.into());
111        self
112    }
113    /// <p>When <code>IsTruncated</code> is <code>true</code>, this element is present and contains the value to use for the <code>Marker</code> parameter in a subsequent pagination request.</p>
114    pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
115        self.marker = input;
116        self
117    }
118    /// <p>When <code>IsTruncated</code> is <code>true</code>, this element is present and contains the value to use for the <code>Marker</code> parameter in a subsequent pagination request.</p>
119    pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
120        &self.marker
121    }
122    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
123        self._request_id = Some(request_id.into());
124        self
125    }
126
127    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
128        self._request_id = request_id;
129        self
130    }
131    /// Consumes the builder and constructs a [`GetGroupOutput`](crate::operation::get_group::GetGroupOutput).
132    /// This method will fail if any of the following fields are not set:
133    /// - [`users`](crate::operation::get_group::builders::GetGroupOutputBuilder::users)
134    pub fn build(self) -> ::std::result::Result<crate::operation::get_group::GetGroupOutput, ::aws_smithy_types::error::operation::BuildError> {
135        ::std::result::Result::Ok(crate::operation::get_group::GetGroupOutput {
136            group: self.group,
137            users: self.users.ok_or_else(|| {
138                ::aws_smithy_types::error::operation::BuildError::missing_field(
139                    "users",
140                    "users was not specified but it is required when building GetGroupOutput",
141                )
142            })?,
143            is_truncated: self.is_truncated.unwrap_or_default(),
144            marker: self.marker,
145            _request_id: self._request_id,
146        })
147    }
148}