aws_sdk_licensemanager/operation/create_grant/_create_grant_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 CreateGrantInput {
6 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
7 pub client_token: ::std::option::Option<::std::string::String>,
8 /// <p>Grant name.</p>
9 pub grant_name: ::std::option::Option<::std::string::String>,
10 /// <p>Amazon Resource Name (ARN) of the license.</p>
11 pub license_arn: ::std::option::Option<::std::string::String>,
12 /// <p>The grant principals. You can specify one of the following as an Amazon Resource Name (ARN):</p>
13 /// <ul>
14 /// <li>
15 /// <p>An Amazon Web Services account, which includes only the account specified.</p></li>
16 /// </ul>
17 /// <ul>
18 /// <li>
19 /// <p>An organizational unit (OU), which includes all accounts in the OU.</p></li>
20 /// </ul>
21 /// <ul>
22 /// <li>
23 /// <p>An organization, which will include all accounts across your organization.</p></li>
24 /// </ul>
25 pub principals: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
26 /// <p>Home Region of the grant.</p>
27 pub home_region: ::std::option::Option<::std::string::String>,
28 /// <p>Allowed operations for the grant.</p>
29 pub allowed_operations: ::std::option::Option<::std::vec::Vec<crate::types::AllowedOperation>>,
30 /// <p>Tags to add to the grant. For more information about tagging support in License Manager, see the <a href="https://docs.aws.amazon.com/license-manager/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>
31 pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
32}
33impl CreateGrantInput {
34 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
35 pub fn client_token(&self) -> ::std::option::Option<&str> {
36 self.client_token.as_deref()
37 }
38 /// <p>Grant name.</p>
39 pub fn grant_name(&self) -> ::std::option::Option<&str> {
40 self.grant_name.as_deref()
41 }
42 /// <p>Amazon Resource Name (ARN) of the license.</p>
43 pub fn license_arn(&self) -> ::std::option::Option<&str> {
44 self.license_arn.as_deref()
45 }
46 /// <p>The grant principals. You can specify one of the following as an Amazon Resource Name (ARN):</p>
47 /// <ul>
48 /// <li>
49 /// <p>An Amazon Web Services account, which includes only the account specified.</p></li>
50 /// </ul>
51 /// <ul>
52 /// <li>
53 /// <p>An organizational unit (OU), which includes all accounts in the OU.</p></li>
54 /// </ul>
55 /// <ul>
56 /// <li>
57 /// <p>An organization, which will include all accounts across your organization.</p></li>
58 /// </ul>
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 `.principals.is_none()`.
61 pub fn principals(&self) -> &[::std::string::String] {
62 self.principals.as_deref().unwrap_or_default()
63 }
64 /// <p>Home Region of the grant.</p>
65 pub fn home_region(&self) -> ::std::option::Option<&str> {
66 self.home_region.as_deref()
67 }
68 /// <p>Allowed operations for the grant.</p>
69 ///
70 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.allowed_operations.is_none()`.
71 pub fn allowed_operations(&self) -> &[crate::types::AllowedOperation] {
72 self.allowed_operations.as_deref().unwrap_or_default()
73 }
74 /// <p>Tags to add to the grant. For more information about tagging support in License Manager, see the <a href="https://docs.aws.amazon.com/license-manager/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>
75 ///
76 /// 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()`.
77 pub fn tags(&self) -> &[crate::types::Tag] {
78 self.tags.as_deref().unwrap_or_default()
79 }
80}
81impl CreateGrantInput {
82 /// Creates a new builder-style object to manufacture [`CreateGrantInput`](crate::operation::create_grant::CreateGrantInput).
83 pub fn builder() -> crate::operation::create_grant::builders::CreateGrantInputBuilder {
84 crate::operation::create_grant::builders::CreateGrantInputBuilder::default()
85 }
86}
87
88/// A builder for [`CreateGrantInput`](crate::operation::create_grant::CreateGrantInput).
89#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
90#[non_exhaustive]
91pub struct CreateGrantInputBuilder {
92 pub(crate) client_token: ::std::option::Option<::std::string::String>,
93 pub(crate) grant_name: ::std::option::Option<::std::string::String>,
94 pub(crate) license_arn: ::std::option::Option<::std::string::String>,
95 pub(crate) principals: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
96 pub(crate) home_region: ::std::option::Option<::std::string::String>,
97 pub(crate) allowed_operations: ::std::option::Option<::std::vec::Vec<crate::types::AllowedOperation>>,
98 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
99}
100impl CreateGrantInputBuilder {
101 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
102 /// This field is required.
103 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104 self.client_token = ::std::option::Option::Some(input.into());
105 self
106 }
107 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
108 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109 self.client_token = input;
110 self
111 }
112 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
113 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
114 &self.client_token
115 }
116 /// <p>Grant name.</p>
117 /// This field is required.
118 pub fn grant_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119 self.grant_name = ::std::option::Option::Some(input.into());
120 self
121 }
122 /// <p>Grant name.</p>
123 pub fn set_grant_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124 self.grant_name = input;
125 self
126 }
127 /// <p>Grant name.</p>
128 pub fn get_grant_name(&self) -> &::std::option::Option<::std::string::String> {
129 &self.grant_name
130 }
131 /// <p>Amazon Resource Name (ARN) of the license.</p>
132 /// This field is required.
133 pub fn license_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134 self.license_arn = ::std::option::Option::Some(input.into());
135 self
136 }
137 /// <p>Amazon Resource Name (ARN) of the license.</p>
138 pub fn set_license_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139 self.license_arn = input;
140 self
141 }
142 /// <p>Amazon Resource Name (ARN) of the license.</p>
143 pub fn get_license_arn(&self) -> &::std::option::Option<::std::string::String> {
144 &self.license_arn
145 }
146 /// Appends an item to `principals`.
147 ///
148 /// To override the contents of this collection use [`set_principals`](Self::set_principals).
149 ///
150 /// <p>The grant principals. You can specify one of the following as an Amazon Resource Name (ARN):</p>
151 /// <ul>
152 /// <li>
153 /// <p>An Amazon Web Services account, which includes only the account specified.</p></li>
154 /// </ul>
155 /// <ul>
156 /// <li>
157 /// <p>An organizational unit (OU), which includes all accounts in the OU.</p></li>
158 /// </ul>
159 /// <ul>
160 /// <li>
161 /// <p>An organization, which will include all accounts across your organization.</p></li>
162 /// </ul>
163 pub fn principals(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164 let mut v = self.principals.unwrap_or_default();
165 v.push(input.into());
166 self.principals = ::std::option::Option::Some(v);
167 self
168 }
169 /// <p>The grant principals. You can specify one of the following as an Amazon Resource Name (ARN):</p>
170 /// <ul>
171 /// <li>
172 /// <p>An Amazon Web Services account, which includes only the account specified.</p></li>
173 /// </ul>
174 /// <ul>
175 /// <li>
176 /// <p>An organizational unit (OU), which includes all accounts in the OU.</p></li>
177 /// </ul>
178 /// <ul>
179 /// <li>
180 /// <p>An organization, which will include all accounts across your organization.</p></li>
181 /// </ul>
182 pub fn set_principals(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
183 self.principals = input;
184 self
185 }
186 /// <p>The grant principals. You can specify one of the following as an Amazon Resource Name (ARN):</p>
187 /// <ul>
188 /// <li>
189 /// <p>An Amazon Web Services account, which includes only the account specified.</p></li>
190 /// </ul>
191 /// <ul>
192 /// <li>
193 /// <p>An organizational unit (OU), which includes all accounts in the OU.</p></li>
194 /// </ul>
195 /// <ul>
196 /// <li>
197 /// <p>An organization, which will include all accounts across your organization.</p></li>
198 /// </ul>
199 pub fn get_principals(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
200 &self.principals
201 }
202 /// <p>Home Region of the grant.</p>
203 /// This field is required.
204 pub fn home_region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205 self.home_region = ::std::option::Option::Some(input.into());
206 self
207 }
208 /// <p>Home Region of the grant.</p>
209 pub fn set_home_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210 self.home_region = input;
211 self
212 }
213 /// <p>Home Region of the grant.</p>
214 pub fn get_home_region(&self) -> &::std::option::Option<::std::string::String> {
215 &self.home_region
216 }
217 /// Appends an item to `allowed_operations`.
218 ///
219 /// To override the contents of this collection use [`set_allowed_operations`](Self::set_allowed_operations).
220 ///
221 /// <p>Allowed operations for the grant.</p>
222 pub fn allowed_operations(mut self, input: crate::types::AllowedOperation) -> Self {
223 let mut v = self.allowed_operations.unwrap_or_default();
224 v.push(input);
225 self.allowed_operations = ::std::option::Option::Some(v);
226 self
227 }
228 /// <p>Allowed operations for the grant.</p>
229 pub fn set_allowed_operations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AllowedOperation>>) -> Self {
230 self.allowed_operations = input;
231 self
232 }
233 /// <p>Allowed operations for the grant.</p>
234 pub fn get_allowed_operations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AllowedOperation>> {
235 &self.allowed_operations
236 }
237 /// Appends an item to `tags`.
238 ///
239 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
240 ///
241 /// <p>Tags to add to the grant. For more information about tagging support in License Manager, see the <a href="https://docs.aws.amazon.com/license-manager/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>
242 pub fn tags(mut self, input: crate::types::Tag) -> Self {
243 let mut v = self.tags.unwrap_or_default();
244 v.push(input);
245 self.tags = ::std::option::Option::Some(v);
246 self
247 }
248 /// <p>Tags to add to the grant. For more information about tagging support in License Manager, see the <a href="https://docs.aws.amazon.com/license-manager/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>
249 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
250 self.tags = input;
251 self
252 }
253 /// <p>Tags to add to the grant. For more information about tagging support in License Manager, see the <a href="https://docs.aws.amazon.com/license-manager/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>
254 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
255 &self.tags
256 }
257 /// Consumes the builder and constructs a [`CreateGrantInput`](crate::operation::create_grant::CreateGrantInput).
258 pub fn build(self) -> ::std::result::Result<crate::operation::create_grant::CreateGrantInput, ::aws_smithy_types::error::operation::BuildError> {
259 ::std::result::Result::Ok(crate::operation::create_grant::CreateGrantInput {
260 client_token: self.client_token,
261 grant_name: self.grant_name,
262 license_arn: self.license_arn,
263 principals: self.principals,
264 home_region: self.home_region,
265 allowed_operations: self.allowed_operations,
266 tags: self.tags,
267 })
268 }
269}