Skip to main content

aws_sdk_lambda/operation/add_permission/
_add_permission_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 AddPermissionInput {
6    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
7    /// <p class="title"><b>Name formats</b></p>
8    /// <ul>
9    /// <li>
10    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
11    /// <li>
12    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
13    /// <li>
14    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
15    /// </ul>
16    /// <p>You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
17    pub function_name: ::std::option::Option<::std::string::String>,
18    /// <p>A statement identifier that differentiates the statement from others in the same policy.</p>
19    pub statement_id: ::std::option::Option<::std::string::String>,
20    /// <p>The action that the principal can use on the function. For example, <code>lambda:InvokeFunction</code> or <code>lambda:GetFunction</code>.</p>
21    pub action: ::std::option::Option<::std::string::String>,
22    /// <p>The Amazon Web Services service, Amazon Web Services account, IAM user, or IAM role that invokes the function. If you specify a service, use <code>SourceArn</code> or <code>SourceAccount</code> to limit who can invoke the function through that service.</p>
23    pub principal: ::std::option::Option<::std::string::String>,
24    /// <p>For Amazon Web Services services, the ARN of the Amazon Web Services resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.</p>
25    /// <p>Note that Lambda configures the comparison using the <code>StringLike</code> operator.</p>
26    pub source_arn: ::std::option::Option<::std::string::String>,
27    /// <p>The type of authentication that your function URL uses. Set to <code>AWS_IAM</code> if you want to restrict access to authenticated users only. Set to <code>NONE</code> if you want to bypass IAM authentication to create a public endpoint. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html">Control access to Lambda function URLs</a>.</p>
28    pub function_url_auth_type: ::std::option::Option<crate::types::FunctionUrlAuthType>,
29    /// <p>Indicates whether the permission applies when the function is invoked through a function URL.</p>
30    pub invoked_via_function_url: ::std::option::Option<bool>,
31    /// <p>For Amazon Web Services service, the ID of the Amazon Web Services account that owns the resource. Use this together with <code>SourceArn</code> to ensure that the specified account owns the resource. It is possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account.</p>
32    pub source_account: ::std::option::Option<::std::string::String>,
33    /// <p>For Alexa Smart Home functions, a token that the invoker must supply.</p>
34    pub event_source_token: ::std::option::Option<::std::string::String>,
35    /// <p>Specify a version or alias to add permissions to a published version of the function.</p>
36    pub qualifier: ::std::option::Option<::std::string::String>,
37    /// <p>Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid modifying a policy that has changed since you last read it.</p>
38    pub revision_id: ::std::option::Option<::std::string::String>,
39    /// <p>The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web Services accounts under this organization.</p>
40    pub principal_org_id: ::std::option::Option<::std::string::String>,
41}
42impl AddPermissionInput {
43    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
44    /// <p class="title"><b>Name formats</b></p>
45    /// <ul>
46    /// <li>
47    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
48    /// <li>
49    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
50    /// <li>
51    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
52    /// </ul>
53    /// <p>You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
54    pub fn function_name(&self) -> ::std::option::Option<&str> {
55        self.function_name.as_deref()
56    }
57    /// <p>A statement identifier that differentiates the statement from others in the same policy.</p>
58    pub fn statement_id(&self) -> ::std::option::Option<&str> {
59        self.statement_id.as_deref()
60    }
61    /// <p>The action that the principal can use on the function. For example, <code>lambda:InvokeFunction</code> or <code>lambda:GetFunction</code>.</p>
62    pub fn action(&self) -> ::std::option::Option<&str> {
63        self.action.as_deref()
64    }
65    /// <p>The Amazon Web Services service, Amazon Web Services account, IAM user, or IAM role that invokes the function. If you specify a service, use <code>SourceArn</code> or <code>SourceAccount</code> to limit who can invoke the function through that service.</p>
66    pub fn principal(&self) -> ::std::option::Option<&str> {
67        self.principal.as_deref()
68    }
69    /// <p>For Amazon Web Services services, the ARN of the Amazon Web Services resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.</p>
70    /// <p>Note that Lambda configures the comparison using the <code>StringLike</code> operator.</p>
71    pub fn source_arn(&self) -> ::std::option::Option<&str> {
72        self.source_arn.as_deref()
73    }
74    /// <p>The type of authentication that your function URL uses. Set to <code>AWS_IAM</code> if you want to restrict access to authenticated users only. Set to <code>NONE</code> if you want to bypass IAM authentication to create a public endpoint. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html">Control access to Lambda function URLs</a>.</p>
75    pub fn function_url_auth_type(&self) -> ::std::option::Option<&crate::types::FunctionUrlAuthType> {
76        self.function_url_auth_type.as_ref()
77    }
78    /// <p>Indicates whether the permission applies when the function is invoked through a function URL.</p>
79    pub fn invoked_via_function_url(&self) -> ::std::option::Option<bool> {
80        self.invoked_via_function_url
81    }
82    /// <p>For Amazon Web Services service, the ID of the Amazon Web Services account that owns the resource. Use this together with <code>SourceArn</code> to ensure that the specified account owns the resource. It is possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account.</p>
83    pub fn source_account(&self) -> ::std::option::Option<&str> {
84        self.source_account.as_deref()
85    }
86    /// <p>For Alexa Smart Home functions, a token that the invoker must supply.</p>
87    pub fn event_source_token(&self) -> ::std::option::Option<&str> {
88        self.event_source_token.as_deref()
89    }
90    /// <p>Specify a version or alias to add permissions to a published version of the function.</p>
91    pub fn qualifier(&self) -> ::std::option::Option<&str> {
92        self.qualifier.as_deref()
93    }
94    /// <p>Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid modifying a policy that has changed since you last read it.</p>
95    pub fn revision_id(&self) -> ::std::option::Option<&str> {
96        self.revision_id.as_deref()
97    }
98    /// <p>The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web Services accounts under this organization.</p>
99    pub fn principal_org_id(&self) -> ::std::option::Option<&str> {
100        self.principal_org_id.as_deref()
101    }
102}
103impl AddPermissionInput {
104    /// Creates a new builder-style object to manufacture [`AddPermissionInput`](crate::operation::add_permission::AddPermissionInput).
105    pub fn builder() -> crate::operation::add_permission::builders::AddPermissionInputBuilder {
106        crate::operation::add_permission::builders::AddPermissionInputBuilder::default()
107    }
108}
109
110/// A builder for [`AddPermissionInput`](crate::operation::add_permission::AddPermissionInput).
111#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
112#[non_exhaustive]
113pub struct AddPermissionInputBuilder {
114    pub(crate) function_name: ::std::option::Option<::std::string::String>,
115    pub(crate) statement_id: ::std::option::Option<::std::string::String>,
116    pub(crate) action: ::std::option::Option<::std::string::String>,
117    pub(crate) principal: ::std::option::Option<::std::string::String>,
118    pub(crate) source_arn: ::std::option::Option<::std::string::String>,
119    pub(crate) function_url_auth_type: ::std::option::Option<crate::types::FunctionUrlAuthType>,
120    pub(crate) invoked_via_function_url: ::std::option::Option<bool>,
121    pub(crate) source_account: ::std::option::Option<::std::string::String>,
122    pub(crate) event_source_token: ::std::option::Option<::std::string::String>,
123    pub(crate) qualifier: ::std::option::Option<::std::string::String>,
124    pub(crate) revision_id: ::std::option::Option<::std::string::String>,
125    pub(crate) principal_org_id: ::std::option::Option<::std::string::String>,
126}
127impl AddPermissionInputBuilder {
128    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
129    /// <p class="title"><b>Name formats</b></p>
130    /// <ul>
131    /// <li>
132    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
133    /// <li>
134    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
135    /// <li>
136    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
137    /// </ul>
138    /// <p>You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
139    /// This field is required.
140    pub fn function_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.function_name = ::std::option::Option::Some(input.into());
142        self
143    }
144    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
145    /// <p class="title"><b>Name formats</b></p>
146    /// <ul>
147    /// <li>
148    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
149    /// <li>
150    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
151    /// <li>
152    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
153    /// </ul>
154    /// <p>You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
155    pub fn set_function_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
156        self.function_name = input;
157        self
158    }
159    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
160    /// <p class="title"><b>Name formats</b></p>
161    /// <ul>
162    /// <li>
163    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
164    /// <li>
165    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
166    /// <li>
167    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
168    /// </ul>
169    /// <p>You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
170    pub fn get_function_name(&self) -> &::std::option::Option<::std::string::String> {
171        &self.function_name
172    }
173    /// <p>A statement identifier that differentiates the statement from others in the same policy.</p>
174    /// This field is required.
175    pub fn statement_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176        self.statement_id = ::std::option::Option::Some(input.into());
177        self
178    }
179    /// <p>A statement identifier that differentiates the statement from others in the same policy.</p>
180    pub fn set_statement_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181        self.statement_id = input;
182        self
183    }
184    /// <p>A statement identifier that differentiates the statement from others in the same policy.</p>
185    pub fn get_statement_id(&self) -> &::std::option::Option<::std::string::String> {
186        &self.statement_id
187    }
188    /// <p>The action that the principal can use on the function. For example, <code>lambda:InvokeFunction</code> or <code>lambda:GetFunction</code>.</p>
189    /// This field is required.
190    pub fn action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.action = ::std::option::Option::Some(input.into());
192        self
193    }
194    /// <p>The action that the principal can use on the function. For example, <code>lambda:InvokeFunction</code> or <code>lambda:GetFunction</code>.</p>
195    pub fn set_action(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196        self.action = input;
197        self
198    }
199    /// <p>The action that the principal can use on the function. For example, <code>lambda:InvokeFunction</code> or <code>lambda:GetFunction</code>.</p>
200    pub fn get_action(&self) -> &::std::option::Option<::std::string::String> {
201        &self.action
202    }
203    /// <p>The Amazon Web Services service, Amazon Web Services account, IAM user, or IAM role that invokes the function. If you specify a service, use <code>SourceArn</code> or <code>SourceAccount</code> to limit who can invoke the function through that service.</p>
204    /// This field is required.
205    pub fn principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
206        self.principal = ::std::option::Option::Some(input.into());
207        self
208    }
209    /// <p>The Amazon Web Services service, Amazon Web Services account, IAM user, or IAM role that invokes the function. If you specify a service, use <code>SourceArn</code> or <code>SourceAccount</code> to limit who can invoke the function through that service.</p>
210    pub fn set_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
211        self.principal = input;
212        self
213    }
214    /// <p>The Amazon Web Services service, Amazon Web Services account, IAM user, or IAM role that invokes the function. If you specify a service, use <code>SourceArn</code> or <code>SourceAccount</code> to limit who can invoke the function through that service.</p>
215    pub fn get_principal(&self) -> &::std::option::Option<::std::string::String> {
216        &self.principal
217    }
218    /// <p>For Amazon Web Services services, the ARN of the Amazon Web Services resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.</p>
219    /// <p>Note that Lambda configures the comparison using the <code>StringLike</code> operator.</p>
220    pub fn source_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
221        self.source_arn = ::std::option::Option::Some(input.into());
222        self
223    }
224    /// <p>For Amazon Web Services services, the ARN of the Amazon Web Services resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.</p>
225    /// <p>Note that Lambda configures the comparison using the <code>StringLike</code> operator.</p>
226    pub fn set_source_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
227        self.source_arn = input;
228        self
229    }
230    /// <p>For Amazon Web Services services, the ARN of the Amazon Web Services resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.</p>
231    /// <p>Note that Lambda configures the comparison using the <code>StringLike</code> operator.</p>
232    pub fn get_source_arn(&self) -> &::std::option::Option<::std::string::String> {
233        &self.source_arn
234    }
235    /// <p>The type of authentication that your function URL uses. Set to <code>AWS_IAM</code> if you want to restrict access to authenticated users only. Set to <code>NONE</code> if you want to bypass IAM authentication to create a public endpoint. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html">Control access to Lambda function URLs</a>.</p>
236    pub fn function_url_auth_type(mut self, input: crate::types::FunctionUrlAuthType) -> Self {
237        self.function_url_auth_type = ::std::option::Option::Some(input);
238        self
239    }
240    /// <p>The type of authentication that your function URL uses. Set to <code>AWS_IAM</code> if you want to restrict access to authenticated users only. Set to <code>NONE</code> if you want to bypass IAM authentication to create a public endpoint. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html">Control access to Lambda function URLs</a>.</p>
241    pub fn set_function_url_auth_type(mut self, input: ::std::option::Option<crate::types::FunctionUrlAuthType>) -> Self {
242        self.function_url_auth_type = input;
243        self
244    }
245    /// <p>The type of authentication that your function URL uses. Set to <code>AWS_IAM</code> if you want to restrict access to authenticated users only. Set to <code>NONE</code> if you want to bypass IAM authentication to create a public endpoint. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html">Control access to Lambda function URLs</a>.</p>
246    pub fn get_function_url_auth_type(&self) -> &::std::option::Option<crate::types::FunctionUrlAuthType> {
247        &self.function_url_auth_type
248    }
249    /// <p>Indicates whether the permission applies when the function is invoked through a function URL.</p>
250    pub fn invoked_via_function_url(mut self, input: bool) -> Self {
251        self.invoked_via_function_url = ::std::option::Option::Some(input);
252        self
253    }
254    /// <p>Indicates whether the permission applies when the function is invoked through a function URL.</p>
255    pub fn set_invoked_via_function_url(mut self, input: ::std::option::Option<bool>) -> Self {
256        self.invoked_via_function_url = input;
257        self
258    }
259    /// <p>Indicates whether the permission applies when the function is invoked through a function URL.</p>
260    pub fn get_invoked_via_function_url(&self) -> &::std::option::Option<bool> {
261        &self.invoked_via_function_url
262    }
263    /// <p>For Amazon Web Services service, the ID of the Amazon Web Services account that owns the resource. Use this together with <code>SourceArn</code> to ensure that the specified account owns the resource. It is possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account.</p>
264    pub fn source_account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
265        self.source_account = ::std::option::Option::Some(input.into());
266        self
267    }
268    /// <p>For Amazon Web Services service, the ID of the Amazon Web Services account that owns the resource. Use this together with <code>SourceArn</code> to ensure that the specified account owns the resource. It is possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account.</p>
269    pub fn set_source_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
270        self.source_account = input;
271        self
272    }
273    /// <p>For Amazon Web Services service, the ID of the Amazon Web Services account that owns the resource. Use this together with <code>SourceArn</code> to ensure that the specified account owns the resource. It is possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account.</p>
274    pub fn get_source_account(&self) -> &::std::option::Option<::std::string::String> {
275        &self.source_account
276    }
277    /// <p>For Alexa Smart Home functions, a token that the invoker must supply.</p>
278    pub fn event_source_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
279        self.event_source_token = ::std::option::Option::Some(input.into());
280        self
281    }
282    /// <p>For Alexa Smart Home functions, a token that the invoker must supply.</p>
283    pub fn set_event_source_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
284        self.event_source_token = input;
285        self
286    }
287    /// <p>For Alexa Smart Home functions, a token that the invoker must supply.</p>
288    pub fn get_event_source_token(&self) -> &::std::option::Option<::std::string::String> {
289        &self.event_source_token
290    }
291    /// <p>Specify a version or alias to add permissions to a published version of the function.</p>
292    pub fn qualifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
293        self.qualifier = ::std::option::Option::Some(input.into());
294        self
295    }
296    /// <p>Specify a version or alias to add permissions to a published version of the function.</p>
297    pub fn set_qualifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
298        self.qualifier = input;
299        self
300    }
301    /// <p>Specify a version or alias to add permissions to a published version of the function.</p>
302    pub fn get_qualifier(&self) -> &::std::option::Option<::std::string::String> {
303        &self.qualifier
304    }
305    /// <p>Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid modifying a policy that has changed since you last read it.</p>
306    pub fn revision_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
307        self.revision_id = ::std::option::Option::Some(input.into());
308        self
309    }
310    /// <p>Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid modifying a policy that has changed since you last read it.</p>
311    pub fn set_revision_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
312        self.revision_id = input;
313        self
314    }
315    /// <p>Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid modifying a policy that has changed since you last read it.</p>
316    pub fn get_revision_id(&self) -> &::std::option::Option<::std::string::String> {
317        &self.revision_id
318    }
319    /// <p>The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web Services accounts under this organization.</p>
320    pub fn principal_org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
321        self.principal_org_id = ::std::option::Option::Some(input.into());
322        self
323    }
324    /// <p>The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web Services accounts under this organization.</p>
325    pub fn set_principal_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
326        self.principal_org_id = input;
327        self
328    }
329    /// <p>The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web Services accounts under this organization.</p>
330    pub fn get_principal_org_id(&self) -> &::std::option::Option<::std::string::String> {
331        &self.principal_org_id
332    }
333    /// Consumes the builder and constructs a [`AddPermissionInput`](crate::operation::add_permission::AddPermissionInput).
334    pub fn build(
335        self,
336    ) -> ::std::result::Result<crate::operation::add_permission::AddPermissionInput, ::aws_smithy_types::error::operation::BuildError> {
337        ::std::result::Result::Ok(crate::operation::add_permission::AddPermissionInput {
338            function_name: self.function_name,
339            statement_id: self.statement_id,
340            action: self.action,
341            principal: self.principal,
342            source_arn: self.source_arn,
343            function_url_auth_type: self.function_url_auth_type,
344            invoked_via_function_url: self.invoked_via_function_url,
345            source_account: self.source_account,
346            event_source_token: self.event_source_token,
347            qualifier: self.qualifier,
348            revision_id: self.revision_id,
349            principal_org_id: self.principal_org_id,
350        })
351    }
352}