aws_sdk_ram/operation/create_permission/
_create_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 CreatePermissionInput {
6    /// <p>Specifies the name of the customer managed permission. The name must be unique within the Amazon Web Services Region.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>Specifies the name of the resource type that this customer managed permission applies to.</p>
9    /// <p>The format is <code> <i><service-code></service-code></i>:<i><resource-type></resource-type></i> </code> and is not case sensitive. For example, to specify an Amazon EC2 Subnet, you can use the string <code>ec2:subnet</code>. To see the list of valid values for this parameter, query the <code>ListResourceTypes</code> operation.</p>
10    pub resource_type: ::std::option::Option<::std::string::String>,
11    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
12    /// <ul>
13    /// <li>
14    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
15    /// <li>
16    /// <p><b>Action</b>: specifies the actions that are allowed by this customer managed permission. The list must contain only actions that are supported by the specified resource type. For a list of all actions supported by each resource type, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html">Actions, resources, and condition keys for Amazon Web Services services</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
17    /// <li>
18    /// <p><b>Condition</b>: (optional) specifies conditional parameters that must evaluate to true when a user attempts an action for that action to be allowed. For more information about the Condition element, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM policies: Condition element</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
19    /// </ul>
20    /// <p>This template can't include either the <code>Resource</code> or <code>Principal</code> elements. Those are both filled in by RAM when it instantiates the resource-based policy on each resource shared using this managed permission. The <code>Resource</code> comes from the ARN of the specific resource that you are sharing. The <code>Principal</code> comes from the list of identities added to the resource share.</p>
21    pub policy_template: ::std::option::Option<::std::string::String>,
22    /// <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
23    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
24    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
25    pub client_token: ::std::option::Option<::std::string::String>,
26    /// <p>Specifies a list of one or more tag key and value pairs to attach to the permission.</p>
27    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
28}
29impl CreatePermissionInput {
30    /// <p>Specifies the name of the customer managed permission. The name must be unique within the Amazon Web Services Region.</p>
31    pub fn name(&self) -> ::std::option::Option<&str> {
32        self.name.as_deref()
33    }
34    /// <p>Specifies the name of the resource type that this customer managed permission applies to.</p>
35    /// <p>The format is <code> <i><service-code></service-code></i>:<i><resource-type></resource-type></i> </code> and is not case sensitive. For example, to specify an Amazon EC2 Subnet, you can use the string <code>ec2:subnet</code>. To see the list of valid values for this parameter, query the <code>ListResourceTypes</code> operation.</p>
36    pub fn resource_type(&self) -> ::std::option::Option<&str> {
37        self.resource_type.as_deref()
38    }
39    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
40    /// <ul>
41    /// <li>
42    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
43    /// <li>
44    /// <p><b>Action</b>: specifies the actions that are allowed by this customer managed permission. The list must contain only actions that are supported by the specified resource type. For a list of all actions supported by each resource type, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html">Actions, resources, and condition keys for Amazon Web Services services</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
45    /// <li>
46    /// <p><b>Condition</b>: (optional) specifies conditional parameters that must evaluate to true when a user attempts an action for that action to be allowed. For more information about the Condition element, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM policies: Condition element</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
47    /// </ul>
48    /// <p>This template can't include either the <code>Resource</code> or <code>Principal</code> elements. Those are both filled in by RAM when it instantiates the resource-based policy on each resource shared using this managed permission. The <code>Resource</code> comes from the ARN of the specific resource that you are sharing. The <code>Principal</code> comes from the list of identities added to the resource share.</p>
49    pub fn policy_template(&self) -> ::std::option::Option<&str> {
50        self.policy_template.as_deref()
51    }
52    /// <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
53    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
54    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
55    pub fn client_token(&self) -> ::std::option::Option<&str> {
56        self.client_token.as_deref()
57    }
58    /// <p>Specifies a list of one or more tag key and value pairs to attach to the permission.</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}
65impl CreatePermissionInput {
66    /// Creates a new builder-style object to manufacture [`CreatePermissionInput`](crate::operation::create_permission::CreatePermissionInput).
67    pub fn builder() -> crate::operation::create_permission::builders::CreatePermissionInputBuilder {
68        crate::operation::create_permission::builders::CreatePermissionInputBuilder::default()
69    }
70}
71
72/// A builder for [`CreatePermissionInput`](crate::operation::create_permission::CreatePermissionInput).
73#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
74#[non_exhaustive]
75pub struct CreatePermissionInputBuilder {
76    pub(crate) name: ::std::option::Option<::std::string::String>,
77    pub(crate) resource_type: ::std::option::Option<::std::string::String>,
78    pub(crate) policy_template: ::std::option::Option<::std::string::String>,
79    pub(crate) client_token: ::std::option::Option<::std::string::String>,
80    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
81}
82impl CreatePermissionInputBuilder {
83    /// <p>Specifies the name of the customer managed permission. The name must be unique within the Amazon Web Services Region.</p>
84    /// This field is required.
85    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
86        self.name = ::std::option::Option::Some(input.into());
87        self
88    }
89    /// <p>Specifies the name of the customer managed permission. The name must be unique within the Amazon Web Services Region.</p>
90    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
91        self.name = input;
92        self
93    }
94    /// <p>Specifies the name of the customer managed permission. The name must be unique within the Amazon Web Services Region.</p>
95    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
96        &self.name
97    }
98    /// <p>Specifies the name of the resource type that this customer managed permission applies to.</p>
99    /// <p>The format is <code> <i><service-code></service-code></i>:<i><resource-type></resource-type></i> </code> and is not case sensitive. For example, to specify an Amazon EC2 Subnet, you can use the string <code>ec2:subnet</code>. To see the list of valid values for this parameter, query the <code>ListResourceTypes</code> operation.</p>
100    /// This field is required.
101    pub fn resource_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102        self.resource_type = ::std::option::Option::Some(input.into());
103        self
104    }
105    /// <p>Specifies the name of the resource type that this customer managed permission applies to.</p>
106    /// <p>The format is <code> <i><service-code></service-code></i>:<i><resource-type></resource-type></i> </code> and is not case sensitive. For example, to specify an Amazon EC2 Subnet, you can use the string <code>ec2:subnet</code>. To see the list of valid values for this parameter, query the <code>ListResourceTypes</code> operation.</p>
107    pub fn set_resource_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108        self.resource_type = input;
109        self
110    }
111    /// <p>Specifies the name of the resource type that this customer managed permission applies to.</p>
112    /// <p>The format is <code> <i><service-code></service-code></i>:<i><resource-type></resource-type></i> </code> and is not case sensitive. For example, to specify an Amazon EC2 Subnet, you can use the string <code>ec2:subnet</code>. To see the list of valid values for this parameter, query the <code>ListResourceTypes</code> operation.</p>
113    pub fn get_resource_type(&self) -> &::std::option::Option<::std::string::String> {
114        &self.resource_type
115    }
116    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
117    /// <ul>
118    /// <li>
119    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
120    /// <li>
121    /// <p><b>Action</b>: specifies the actions that are allowed by this customer managed permission. The list must contain only actions that are supported by the specified resource type. For a list of all actions supported by each resource type, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html">Actions, resources, and condition keys for Amazon Web Services services</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
122    /// <li>
123    /// <p><b>Condition</b>: (optional) specifies conditional parameters that must evaluate to true when a user attempts an action for that action to be allowed. For more information about the Condition element, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM policies: Condition element</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
124    /// </ul>
125    /// <p>This template can't include either the <code>Resource</code> or <code>Principal</code> elements. Those are both filled in by RAM when it instantiates the resource-based policy on each resource shared using this managed permission. The <code>Resource</code> comes from the ARN of the specific resource that you are sharing. The <code>Principal</code> comes from the list of identities added to the resource share.</p>
126    /// This field is required.
127    pub fn policy_template(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.policy_template = ::std::option::Option::Some(input.into());
129        self
130    }
131    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
132    /// <ul>
133    /// <li>
134    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
135    /// <li>
136    /// <p><b>Action</b>: specifies the actions that are allowed by this customer managed permission. The list must contain only actions that are supported by the specified resource type. For a list of all actions supported by each resource type, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html">Actions, resources, and condition keys for Amazon Web Services services</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
137    /// <li>
138    /// <p><b>Condition</b>: (optional) specifies conditional parameters that must evaluate to true when a user attempts an action for that action to be allowed. For more information about the Condition element, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM policies: Condition element</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
139    /// </ul>
140    /// <p>This template can't include either the <code>Resource</code> or <code>Principal</code> elements. Those are both filled in by RAM when it instantiates the resource-based policy on each resource shared using this managed permission. The <code>Resource</code> comes from the ARN of the specific resource that you are sharing. The <code>Principal</code> comes from the list of identities added to the resource share.</p>
141    pub fn set_policy_template(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142        self.policy_template = input;
143        self
144    }
145    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
146    /// <ul>
147    /// <li>
148    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
149    /// <li>
150    /// <p><b>Action</b>: specifies the actions that are allowed by this customer managed permission. The list must contain only actions that are supported by the specified resource type. For a list of all actions supported by each resource type, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html">Actions, resources, and condition keys for Amazon Web Services services</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
151    /// <li>
152    /// <p><b>Condition</b>: (optional) specifies conditional parameters that must evaluate to true when a user attempts an action for that action to be allowed. For more information about the Condition element, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM policies: Condition element</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
153    /// </ul>
154    /// <p>This template can't include either the <code>Resource</code> or <code>Principal</code> elements. Those are both filled in by RAM when it instantiates the resource-based policy on each resource shared using this managed permission. The <code>Resource</code> comes from the ARN of the specific resource that you are sharing. The <code>Principal</code> comes from the list of identities added to the resource share.</p>
155    pub fn get_policy_template(&self) -> &::std::option::Option<::std::string::String> {
156        &self.policy_template
157    }
158    /// <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
159    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
160    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
161    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162        self.client_token = ::std::option::Option::Some(input.into());
163        self
164    }
165    /// <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
166    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
167    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
168    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169        self.client_token = input;
170        self
171    }
172    /// <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
173    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
174    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
175    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
176        &self.client_token
177    }
178    /// Appends an item to `tags`.
179    ///
180    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
181    ///
182    /// <p>Specifies a list of one or more tag key and value pairs to attach to the permission.</p>
183    pub fn tags(mut self, input: crate::types::Tag) -> Self {
184        let mut v = self.tags.unwrap_or_default();
185        v.push(input);
186        self.tags = ::std::option::Option::Some(v);
187        self
188    }
189    /// <p>Specifies a list of one or more tag key and value pairs to attach to the permission.</p>
190    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
191        self.tags = input;
192        self
193    }
194    /// <p>Specifies a list of one or more tag key and value pairs to attach to the permission.</p>
195    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
196        &self.tags
197    }
198    /// Consumes the builder and constructs a [`CreatePermissionInput`](crate::operation::create_permission::CreatePermissionInput).
199    pub fn build(
200        self,
201    ) -> ::std::result::Result<crate::operation::create_permission::CreatePermissionInput, ::aws_smithy_types::error::operation::BuildError> {
202        ::std::result::Result::Ok(crate::operation::create_permission::CreatePermissionInput {
203            name: self.name,
204            resource_type: self.resource_type,
205            policy_template: self.policy_template,
206            client_token: self.client_token,
207            tags: self.tags,
208        })
209    }
210}