aws_sdk_ram/operation/create_permission_version/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_permission_version::_create_permission_version_output::CreatePermissionVersionOutputBuilder;
3
4pub use crate::operation::create_permission_version::_create_permission_version_input::CreatePermissionVersionInputBuilder;
5
6impl crate::operation::create_permission_version::builders::CreatePermissionVersionInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_permission_version::CreatePermissionVersionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_permission_version::CreatePermissionVersionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_permission_version();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreatePermissionVersion`.
24///
25/// <p>Creates a new version of the specified customer managed permission. The new version is automatically set as the default version of the customer managed permission. New resource shares automatically use the default permission. Existing resource shares continue to use their original permission versions, but you can use <code>ReplacePermissionAssociations</code> to update them.</p>
26/// <p>If the specified customer managed permission already has the maximum of 5 versions, then you must delete one of the existing versions before you can create a new one.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreatePermissionVersionFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::create_permission_version::builders::CreatePermissionVersionInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::create_permission_version::CreatePermissionVersionOutput,
36        crate::operation::create_permission_version::CreatePermissionVersionError,
37    > for CreatePermissionVersionFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::create_permission_version::CreatePermissionVersionOutput,
45            crate::operation::create_permission_version::CreatePermissionVersionError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl CreatePermissionVersionFluentBuilder {
52    /// Creates a new `CreatePermissionVersionFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the CreatePermissionVersion as a reference.
61    pub fn as_input(&self) -> &crate::operation::create_permission_version::builders::CreatePermissionVersionInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::create_permission_version::CreatePermissionVersionOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::create_permission_version::CreatePermissionVersionError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::create_permission_version::CreatePermissionVersion::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::create_permission_version::CreatePermissionVersion::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::create_permission_version::CreatePermissionVersionOutput,
98        crate::operation::create_permission_version::CreatePermissionVersionError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>Specifies the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the customer managed permission you're creating a new version for.</p>
113    pub fn permission_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.permission_arn(input.into());
115        self
116    }
117    /// <p>Specifies the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the customer managed permission you're creating a new version for.</p>
118    pub fn set_permission_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_permission_arn(input);
120        self
121    }
122    /// <p>Specifies the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the customer managed permission you're creating a new version for.</p>
123    pub fn get_permission_arn(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_permission_arn()
125    }
126    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
127    /// <ul>
128    /// <li>
129    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
130    /// <li>
131    /// <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>
132    /// <li>
133    /// <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>
134    /// </ul>
135    /// <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>
136    pub fn policy_template(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.inner = self.inner.policy_template(input.into());
138        self
139    }
140    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
141    /// <ul>
142    /// <li>
143    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
144    /// <li>
145    /// <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>
146    /// <li>
147    /// <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>
148    /// </ul>
149    /// <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>
150    pub fn set_policy_template(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.inner = self.inner.set_policy_template(input);
152        self
153    }
154    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
155    /// <ul>
156    /// <li>
157    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
158    /// <li>
159    /// <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>
160    /// <li>
161    /// <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>
162    /// </ul>
163    /// <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>
164    pub fn get_policy_template(&self) -> &::std::option::Option<::std::string::String> {
165        self.inner.get_policy_template()
166    }
167    /// <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>
168    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
169    /// <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>
170    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
171        self.inner = self.inner.client_token(input.into());
172        self
173    }
174    /// <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>
175    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
176    /// <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>
177    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
178        self.inner = self.inner.set_client_token(input);
179        self
180    }
181    /// <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>
182    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
183    /// <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>
184    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
185        self.inner.get_client_token()
186    }
187}