aws_sdk_rolesanywhere/operation/create_profile/
_create_profile_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateProfileInput {
6    /// <p>The name of the profile.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>Specifies whether instance properties are required in temporary credential requests with this profile.</p>
9    pub require_instance_properties: ::std::option::Option<bool>,
10    /// <p>A session policy that applies to the trust boundary of the vended session credentials.</p>
11    pub session_policy: ::std::option::Option<::std::string::String>,
12    /// <p>A list of IAM roles that this profile can assume in a temporary credential request.</p>
13    pub role_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
14    /// <p>A list of managed policy ARNs that apply to the vended session credentials.</p>
15    pub managed_policy_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
16    /// <p>Used to determine how long sessions vended using this profile are valid for. See the <code>Expiration</code> section of the <a href="https://docs.aws.amazon.com/rolesanywhere/latest/userguide/authentication-create-session.html#credentials-object">CreateSession API documentation</a> page for more details. In requests, if this value is not provided, the default value will be 3600.</p>
17    pub duration_seconds: ::std::option::Option<i32>,
18    /// <p>Specifies whether the profile is enabled.</p>
19    pub enabled: ::std::option::Option<bool>,
20    /// <p>The tags to attach to the profile.</p>
21    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
22    /// <p>Used to determine if a custom role session name will be accepted in a temporary credential request.</p>
23    pub accept_role_session_name: ::std::option::Option<bool>,
24}
25impl CreateProfileInput {
26    /// <p>The name of the profile.</p>
27    pub fn name(&self) -> ::std::option::Option<&str> {
28        self.name.as_deref()
29    }
30    /// <p>Specifies whether instance properties are required in temporary credential requests with this profile.</p>
31    pub fn require_instance_properties(&self) -> ::std::option::Option<bool> {
32        self.require_instance_properties
33    }
34    /// <p>A session policy that applies to the trust boundary of the vended session credentials.</p>
35    pub fn session_policy(&self) -> ::std::option::Option<&str> {
36        self.session_policy.as_deref()
37    }
38    /// <p>A list of IAM roles that this profile can assume in a temporary credential request.</p>
39    ///
40    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.role_arns.is_none()`.
41    pub fn role_arns(&self) -> &[::std::string::String] {
42        self.role_arns.as_deref().unwrap_or_default()
43    }
44    /// <p>A list of managed policy ARNs that apply to the vended session credentials.</p>
45    ///
46    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.managed_policy_arns.is_none()`.
47    pub fn managed_policy_arns(&self) -> &[::std::string::String] {
48        self.managed_policy_arns.as_deref().unwrap_or_default()
49    }
50    /// <p>Used to determine how long sessions vended using this profile are valid for. See the <code>Expiration</code> section of the <a href="https://docs.aws.amazon.com/rolesanywhere/latest/userguide/authentication-create-session.html#credentials-object">CreateSession API documentation</a> page for more details. In requests, if this value is not provided, the default value will be 3600.</p>
51    pub fn duration_seconds(&self) -> ::std::option::Option<i32> {
52        self.duration_seconds
53    }
54    /// <p>Specifies whether the profile is enabled.</p>
55    pub fn enabled(&self) -> ::std::option::Option<bool> {
56        self.enabled
57    }
58    /// <p>The tags to attach to the profile.</p>
59    ///
60    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
61    pub fn tags(&self) -> &[crate::types::Tag] {
62        self.tags.as_deref().unwrap_or_default()
63    }
64    /// <p>Used to determine if a custom role session name will be accepted in a temporary credential request.</p>
65    pub fn accept_role_session_name(&self) -> ::std::option::Option<bool> {
66        self.accept_role_session_name
67    }
68}
69impl CreateProfileInput {
70    /// Creates a new builder-style object to manufacture [`CreateProfileInput`](crate::operation::create_profile::CreateProfileInput).
71    pub fn builder() -> crate::operation::create_profile::builders::CreateProfileInputBuilder {
72        crate::operation::create_profile::builders::CreateProfileInputBuilder::default()
73    }
74}
75
76/// A builder for [`CreateProfileInput`](crate::operation::create_profile::CreateProfileInput).
77#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
78#[non_exhaustive]
79pub struct CreateProfileInputBuilder {
80    pub(crate) name: ::std::option::Option<::std::string::String>,
81    pub(crate) require_instance_properties: ::std::option::Option<bool>,
82    pub(crate) session_policy: ::std::option::Option<::std::string::String>,
83    pub(crate) role_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
84    pub(crate) managed_policy_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
85    pub(crate) duration_seconds: ::std::option::Option<i32>,
86    pub(crate) enabled: ::std::option::Option<bool>,
87    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
88    pub(crate) accept_role_session_name: ::std::option::Option<bool>,
89}
90impl CreateProfileInputBuilder {
91    /// <p>The name of the profile.</p>
92    /// This field is required.
93    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
94        self.name = ::std::option::Option::Some(input.into());
95        self
96    }
97    /// <p>The name of the profile.</p>
98    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
99        self.name = input;
100        self
101    }
102    /// <p>The name of the profile.</p>
103    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
104        &self.name
105    }
106    /// <p>Specifies whether instance properties are required in temporary credential requests with this profile.</p>
107    pub fn require_instance_properties(mut self, input: bool) -> Self {
108        self.require_instance_properties = ::std::option::Option::Some(input);
109        self
110    }
111    /// <p>Specifies whether instance properties are required in temporary credential requests with this profile.</p>
112    pub fn set_require_instance_properties(mut self, input: ::std::option::Option<bool>) -> Self {
113        self.require_instance_properties = input;
114        self
115    }
116    /// <p>Specifies whether instance properties are required in temporary credential requests with this profile.</p>
117    pub fn get_require_instance_properties(&self) -> &::std::option::Option<bool> {
118        &self.require_instance_properties
119    }
120    /// <p>A session policy that applies to the trust boundary of the vended session credentials.</p>
121    pub fn session_policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.session_policy = ::std::option::Option::Some(input.into());
123        self
124    }
125    /// <p>A session policy that applies to the trust boundary of the vended session credentials.</p>
126    pub fn set_session_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127        self.session_policy = input;
128        self
129    }
130    /// <p>A session policy that applies to the trust boundary of the vended session credentials.</p>
131    pub fn get_session_policy(&self) -> &::std::option::Option<::std::string::String> {
132        &self.session_policy
133    }
134    /// Appends an item to `role_arns`.
135    ///
136    /// To override the contents of this collection use [`set_role_arns`](Self::set_role_arns).
137    ///
138    /// <p>A list of IAM roles that this profile can assume in a temporary credential request.</p>
139    pub fn role_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140        let mut v = self.role_arns.unwrap_or_default();
141        v.push(input.into());
142        self.role_arns = ::std::option::Option::Some(v);
143        self
144    }
145    /// <p>A list of IAM roles that this profile can assume in a temporary credential request.</p>
146    pub fn set_role_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
147        self.role_arns = input;
148        self
149    }
150    /// <p>A list of IAM roles that this profile can assume in a temporary credential request.</p>
151    pub fn get_role_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
152        &self.role_arns
153    }
154    /// Appends an item to `managed_policy_arns`.
155    ///
156    /// To override the contents of this collection use [`set_managed_policy_arns`](Self::set_managed_policy_arns).
157    ///
158    /// <p>A list of managed policy ARNs that apply to the vended session credentials.</p>
159    pub fn managed_policy_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        let mut v = self.managed_policy_arns.unwrap_or_default();
161        v.push(input.into());
162        self.managed_policy_arns = ::std::option::Option::Some(v);
163        self
164    }
165    /// <p>A list of managed policy ARNs that apply to the vended session credentials.</p>
166    pub fn set_managed_policy_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
167        self.managed_policy_arns = input;
168        self
169    }
170    /// <p>A list of managed policy ARNs that apply to the vended session credentials.</p>
171    pub fn get_managed_policy_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
172        &self.managed_policy_arns
173    }
174    /// <p>Used to determine how long sessions vended using this profile are valid for. See the <code>Expiration</code> section of the <a href="https://docs.aws.amazon.com/rolesanywhere/latest/userguide/authentication-create-session.html#credentials-object">CreateSession API documentation</a> page for more details. In requests, if this value is not provided, the default value will be 3600.</p>
175    pub fn duration_seconds(mut self, input: i32) -> Self {
176        self.duration_seconds = ::std::option::Option::Some(input);
177        self
178    }
179    /// <p>Used to determine how long sessions vended using this profile are valid for. See the <code>Expiration</code> section of the <a href="https://docs.aws.amazon.com/rolesanywhere/latest/userguide/authentication-create-session.html#credentials-object">CreateSession API documentation</a> page for more details. In requests, if this value is not provided, the default value will be 3600.</p>
180    pub fn set_duration_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
181        self.duration_seconds = input;
182        self
183    }
184    /// <p>Used to determine how long sessions vended using this profile are valid for. See the <code>Expiration</code> section of the <a href="https://docs.aws.amazon.com/rolesanywhere/latest/userguide/authentication-create-session.html#credentials-object">CreateSession API documentation</a> page for more details. In requests, if this value is not provided, the default value will be 3600.</p>
185    pub fn get_duration_seconds(&self) -> &::std::option::Option<i32> {
186        &self.duration_seconds
187    }
188    /// <p>Specifies whether the profile is enabled.</p>
189    pub fn enabled(mut self, input: bool) -> Self {
190        self.enabled = ::std::option::Option::Some(input);
191        self
192    }
193    /// <p>Specifies whether the profile is enabled.</p>
194    pub fn set_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
195        self.enabled = input;
196        self
197    }
198    /// <p>Specifies whether the profile is enabled.</p>
199    pub fn get_enabled(&self) -> &::std::option::Option<bool> {
200        &self.enabled
201    }
202    /// Appends an item to `tags`.
203    ///
204    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
205    ///
206    /// <p>The tags to attach to the profile.</p>
207    pub fn tags(mut self, input: crate::types::Tag) -> Self {
208        let mut v = self.tags.unwrap_or_default();
209        v.push(input);
210        self.tags = ::std::option::Option::Some(v);
211        self
212    }
213    /// <p>The tags to attach to the profile.</p>
214    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
215        self.tags = input;
216        self
217    }
218    /// <p>The tags to attach to the profile.</p>
219    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
220        &self.tags
221    }
222    /// <p>Used to determine if a custom role session name will be accepted in a temporary credential request.</p>
223    pub fn accept_role_session_name(mut self, input: bool) -> Self {
224        self.accept_role_session_name = ::std::option::Option::Some(input);
225        self
226    }
227    /// <p>Used to determine if a custom role session name will be accepted in a temporary credential request.</p>
228    pub fn set_accept_role_session_name(mut self, input: ::std::option::Option<bool>) -> Self {
229        self.accept_role_session_name = input;
230        self
231    }
232    /// <p>Used to determine if a custom role session name will be accepted in a temporary credential request.</p>
233    pub fn get_accept_role_session_name(&self) -> &::std::option::Option<bool> {
234        &self.accept_role_session_name
235    }
236    /// Consumes the builder and constructs a [`CreateProfileInput`](crate::operation::create_profile::CreateProfileInput).
237    pub fn build(
238        self,
239    ) -> ::std::result::Result<crate::operation::create_profile::CreateProfileInput, ::aws_smithy_types::error::operation::BuildError> {
240        ::std::result::Result::Ok(crate::operation::create_profile::CreateProfileInput {
241            name: self.name,
242            require_instance_properties: self.require_instance_properties,
243            session_policy: self.session_policy,
244            role_arns: self.role_arns,
245            managed_policy_arns: self.managed_policy_arns,
246            duration_seconds: self.duration_seconds,
247            enabled: self.enabled,
248            tags: self.tags,
249            accept_role_session_name: self.accept_role_session_name,
250        })
251    }
252}