aws_sdk_lexmodelsv2/operation/create_resource_policy_statement/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_resource_policy_statement::_create_resource_policy_statement_output::CreateResourcePolicyStatementOutputBuilder;
3
4pub use crate::operation::create_resource_policy_statement::_create_resource_policy_statement_input::CreateResourcePolicyStatementInputBuilder;
5
6impl crate::operation::create_resource_policy_statement::builders::CreateResourcePolicyStatementInputBuilder {
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_resource_policy_statement::CreateResourcePolicyStatementOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_resource_policy_statement::CreateResourcePolicyStatementError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_resource_policy_statement();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateResourcePolicyStatement`.
24///
25/// <p>Adds a new resource policy statement to a bot or bot alias. If a resource policy exists, the statement is added to the current resource policy. If a policy doesn't exist, a new policy is created.</p>
26/// <p>You can't create a resource policy statement that allows cross-account access.</p>
27/// <p>You need to add the <code>CreateResourcePolicy</code> or <code>UpdateResourcePolicy</code> action to the bot role in order to call the API.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct CreateResourcePolicyStatementFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::create_resource_policy_statement::builders::CreateResourcePolicyStatementInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::create_resource_policy_statement::CreateResourcePolicyStatementOutput,
37        crate::operation::create_resource_policy_statement::CreateResourcePolicyStatementError,
38    > for CreateResourcePolicyStatementFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::create_resource_policy_statement::CreateResourcePolicyStatementOutput,
46            crate::operation::create_resource_policy_statement::CreateResourcePolicyStatementError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl CreateResourcePolicyStatementFluentBuilder {
53    /// Creates a new `CreateResourcePolicyStatementFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the CreateResourcePolicyStatement as a reference.
62    pub fn as_input(&self) -> &crate::operation::create_resource_policy_statement::builders::CreateResourcePolicyStatementInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::create_resource_policy_statement::CreateResourcePolicyStatementOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::create_resource_policy_statement::CreateResourcePolicyStatementError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::create_resource_policy_statement::CreateResourcePolicyStatement::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::create_resource_policy_statement::CreateResourcePolicyStatement::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::create_resource_policy_statement::CreateResourcePolicyStatementOutput,
99        crate::operation::create_resource_policy_statement::CreateResourcePolicyStatementError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// <p>The Amazon Resource Name (ARN) of the bot or bot alias that the resource policy is attached to.</p>
114    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.inner = self.inner.resource_arn(input.into());
116        self
117    }
118    /// <p>The Amazon Resource Name (ARN) of the bot or bot alias that the resource policy is attached to.</p>
119    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_resource_arn(input);
121        self
122    }
123    /// <p>The Amazon Resource Name (ARN) of the bot or bot alias that the resource policy is attached to.</p>
124    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
125        self.inner.get_resource_arn()
126    }
127    /// <p>The name of the statement. The ID is the same as the <code>Sid</code> IAM property. The statement name must be unique within the policy. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_sid.html">IAM JSON policy elements: Sid</a>.</p>
128    pub fn statement_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.inner = self.inner.statement_id(input.into());
130        self
131    }
132    /// <p>The name of the statement. The ID is the same as the <code>Sid</code> IAM property. The statement name must be unique within the policy. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_sid.html">IAM JSON policy elements: Sid</a>.</p>
133    pub fn set_statement_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.inner = self.inner.set_statement_id(input);
135        self
136    }
137    /// <p>The name of the statement. The ID is the same as the <code>Sid</code> IAM property. The statement name must be unique within the policy. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_sid.html">IAM JSON policy elements: Sid</a>.</p>
138    pub fn get_statement_id(&self) -> &::std::option::Option<::std::string::String> {
139        self.inner.get_statement_id()
140    }
141    /// <p>Determines whether the statement allows or denies access to the resource.</p>
142    pub fn effect(mut self, input: crate::types::Effect) -> Self {
143        self.inner = self.inner.effect(input);
144        self
145    }
146    /// <p>Determines whether the statement allows or denies access to the resource.</p>
147    pub fn set_effect(mut self, input: ::std::option::Option<crate::types::Effect>) -> Self {
148        self.inner = self.inner.set_effect(input);
149        self
150    }
151    /// <p>Determines whether the statement allows or denies access to the resource.</p>
152    pub fn get_effect(&self) -> &::std::option::Option<crate::types::Effect> {
153        self.inner.get_effect()
154    }
155    ///
156    /// Appends an item to `principal`.
157    ///
158    /// To override the contents of this collection use [`set_principal`](Self::set_principal).
159    ///
160    /// <p>An IAM principal, such as an IAM user, IAM role, or Amazon Web Services services that is allowed or denied access to a resource. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html">Amazon Web Services JSON policy elements: Principal</a>.</p>
161    pub fn principal(mut self, input: crate::types::Principal) -> Self {
162        self.inner = self.inner.principal(input);
163        self
164    }
165    /// <p>An IAM principal, such as an IAM user, IAM role, or Amazon Web Services services that is allowed or denied access to a resource. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html">Amazon Web Services JSON policy elements: Principal</a>.</p>
166    pub fn set_principal(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Principal>>) -> Self {
167        self.inner = self.inner.set_principal(input);
168        self
169    }
170    /// <p>An IAM principal, such as an IAM user, IAM role, or Amazon Web Services services that is allowed or denied access to a resource. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html">Amazon Web Services JSON policy elements: Principal</a>.</p>
171    pub fn get_principal(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Principal>> {
172        self.inner.get_principal()
173    }
174    ///
175    /// Appends an item to `action`.
176    ///
177    /// To override the contents of this collection use [`set_action`](Self::set_action).
178    ///
179    /// <p>The Amazon Lex action that this policy either allows or denies. The action must apply to the resource type of the specified ARN. For more information, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonlexv2.html"> Actions, resources, and condition keys for Amazon Lex V2</a>.</p>
180    pub fn action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181        self.inner = self.inner.action(input.into());
182        self
183    }
184    /// <p>The Amazon Lex action that this policy either allows or denies. The action must apply to the resource type of the specified ARN. For more information, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonlexv2.html"> Actions, resources, and condition keys for Amazon Lex V2</a>.</p>
185    pub fn set_action(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
186        self.inner = self.inner.set_action(input);
187        self
188    }
189    /// <p>The Amazon Lex action that this policy either allows or denies. The action must apply to the resource type of the specified ARN. For more information, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonlexv2.html"> Actions, resources, and condition keys for Amazon Lex V2</a>.</p>
190    pub fn get_action(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
191        self.inner.get_action()
192    }
193    ///
194    /// Adds a key-value pair to `condition`.
195    ///
196    /// To override the contents of this collection use [`set_condition`](Self::set_condition).
197    ///
198    /// <p>Specifies a condition when the policy is in effect. If the principal of the policy is a service principal, you must provide two condition blocks, one with a SourceAccount global condition key and one with a SourceArn global condition key.</p>
199    /// <p>For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM JSON policy elements: Condition </a>.</p>
200    pub fn condition(
201        mut self,
202        k: impl ::std::convert::Into<::std::string::String>,
203        v: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
204    ) -> Self {
205        self.inner = self.inner.condition(k.into(), v);
206        self
207    }
208    /// <p>Specifies a condition when the policy is in effect. If the principal of the policy is a service principal, you must provide two condition blocks, one with a SourceAccount global condition key and one with a SourceArn global condition key.</p>
209    /// <p>For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM JSON policy elements: Condition </a>.</p>
210    pub fn set_condition(
211        mut self,
212        input: ::std::option::Option<
213            ::std::collections::HashMap<::std::string::String, ::std::collections::HashMap<::std::string::String, ::std::string::String>>,
214        >,
215    ) -> Self {
216        self.inner = self.inner.set_condition(input);
217        self
218    }
219    /// <p>Specifies a condition when the policy is in effect. If the principal of the policy is a service principal, you must provide two condition blocks, one with a SourceAccount global condition key and one with a SourceArn global condition key.</p>
220    /// <p>For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM JSON policy elements: Condition </a>.</p>
221    pub fn get_condition(
222        &self,
223    ) -> &::std::option::Option<
224        ::std::collections::HashMap<::std::string::String, ::std::collections::HashMap<::std::string::String, ::std::string::String>>,
225    > {
226        self.inner.get_condition()
227    }
228    /// <p>The identifier of the revision of the policy to edit. If this revision ID doesn't match the current revision ID, Amazon Lex throws an exception.</p>
229    /// <p>If you don't specify a revision, Amazon Lex overwrites the contents of the policy with the new values.</p>
230    pub fn expected_revision_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
231        self.inner = self.inner.expected_revision_id(input.into());
232        self
233    }
234    /// <p>The identifier of the revision of the policy to edit. If this revision ID doesn't match the current revision ID, Amazon Lex throws an exception.</p>
235    /// <p>If you don't specify a revision, Amazon Lex overwrites the contents of the policy with the new values.</p>
236    pub fn set_expected_revision_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
237        self.inner = self.inner.set_expected_revision_id(input);
238        self
239    }
240    /// <p>The identifier of the revision of the policy to edit. If this revision ID doesn't match the current revision ID, Amazon Lex throws an exception.</p>
241    /// <p>If you don't specify a revision, Amazon Lex overwrites the contents of the policy with the new values.</p>
242    pub fn get_expected_revision_id(&self) -> &::std::option::Option<::std::string::String> {
243        self.inner.get_expected_revision_id()
244    }
245}