aws_sdk_eventbridge/operation/put_permission/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_permission::_put_permission_output::PutPermissionOutputBuilder;
3
4pub use crate::operation::put_permission::_put_permission_input::PutPermissionInputBuilder;
5
6impl crate::operation::put_permission::builders::PutPermissionInputBuilder {
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::put_permission::PutPermissionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_permission::PutPermissionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_permission();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutPermission`.
24///
25/// <p>Running <code>PutPermission</code> permits the specified Amazon Web Services account or Amazon Web Services organization to put events to the specified <i>event bus</i>. Amazon EventBridge rules in your account are triggered by these events arriving to an event bus in your account.</p>
26/// <p>For another account to send events to your account, that external account must have an EventBridge rule with your account's event bus as a target.</p>
27/// <p>To enable multiple Amazon Web Services accounts to put events to your event bus, run <code>PutPermission</code> once for each of these accounts. Or, if all the accounts are members of the same Amazon Web Services organization, you can run <code>PutPermission</code> once specifying <code>Principal</code> as "*" and specifying the Amazon Web Services organization ID in <code>Condition</code>, to grant permissions to all accounts in that organization.</p>
28/// <p>If you grant permissions using an organization, then accounts in that organization must specify a <code>RoleArn</code> with proper permissions when they use <code>PutTarget</code> to add your account's event bus as a target. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-cross-account-event-delivery.html">Sending and Receiving Events Between Amazon Web Services Accounts</a> in the <i>Amazon EventBridge User Guide</i>.</p>
29/// <p>The permission policy on the event bus cannot exceed 10 KB in size.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct PutPermissionFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::put_permission::builders::PutPermissionInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::put_permission::PutPermissionOutput,
39        crate::operation::put_permission::PutPermissionError,
40    > for PutPermissionFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::put_permission::PutPermissionOutput,
48            crate::operation::put_permission::PutPermissionError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl PutPermissionFluentBuilder {
55    /// Creates a new `PutPermissionFluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the PutPermission as a reference.
64    pub fn as_input(&self) -> &crate::operation::put_permission::builders::PutPermissionInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::put_permission::PutPermissionOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::put_permission::PutPermissionError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::put_permission::PutPermission::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::put_permission::PutPermission::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::put_permission::PutPermissionOutput,
101        crate::operation::put_permission::PutPermissionError,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    /// <p>The name of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
116    pub fn event_bus_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.inner = self.inner.event_bus_name(input.into());
118        self
119    }
120    /// <p>The name of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
121    pub fn set_event_bus_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_event_bus_name(input);
123        self
124    }
125    /// <p>The name of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
126    pub fn get_event_bus_name(&self) -> &::std::option::Option<::std::string::String> {
127        self.inner.get_event_bus_name()
128    }
129    /// <p>The action that you are enabling the other account to perform.</p>
130    pub fn action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.action(input.into());
132        self
133    }
134    /// <p>The action that you are enabling the other account to perform.</p>
135    pub fn set_action(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_action(input);
137        self
138    }
139    /// <p>The action that you are enabling the other account to perform.</p>
140    pub fn get_action(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_action()
142    }
143    /// <p>The 12-digit Amazon Web Services account ID that you are permitting to put events to your default event bus. Specify "*" to permit any account to put events to your default event bus.</p>
144    /// <p>If you specify "*" without specifying <code>Condition</code>, avoid creating rules that may match undesirable events. To create more secure rules, make sure that the event pattern for each rule contains an <code>account</code> field with a specific account ID from which to receive events. Rules with an account field do not match any events sent from other accounts.</p>
145    pub fn principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.principal(input.into());
147        self
148    }
149    /// <p>The 12-digit Amazon Web Services account ID that you are permitting to put events to your default event bus. Specify "*" to permit any account to put events to your default event bus.</p>
150    /// <p>If you specify "*" without specifying <code>Condition</code>, avoid creating rules that may match undesirable events. To create more secure rules, make sure that the event pattern for each rule contains an <code>account</code> field with a specific account ID from which to receive events. Rules with an account field do not match any events sent from other accounts.</p>
151    pub fn set_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_principal(input);
153        self
154    }
155    /// <p>The 12-digit Amazon Web Services account ID that you are permitting to put events to your default event bus. Specify "*" to permit any account to put events to your default event bus.</p>
156    /// <p>If you specify "*" without specifying <code>Condition</code>, avoid creating rules that may match undesirable events. To create more secure rules, make sure that the event pattern for each rule contains an <code>account</code> field with a specific account ID from which to receive events. Rules with an account field do not match any events sent from other accounts.</p>
157    pub fn get_principal(&self) -> &::std::option::Option<::std::string::String> {
158        self.inner.get_principal()
159    }
160    /// <p>An identifier string for the external account that you are granting permissions to. If you later want to revoke the permission for this external account, specify this <code>StatementId</code> when you run <a href="https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_RemovePermission.html">RemovePermission</a>.</p><note>
161    /// <p>Each <code>StatementId</code> must be unique.</p>
162    /// </note>
163    pub fn statement_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164        self.inner = self.inner.statement_id(input.into());
165        self
166    }
167    /// <p>An identifier string for the external account that you are granting permissions to. If you later want to revoke the permission for this external account, specify this <code>StatementId</code> when you run <a href="https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_RemovePermission.html">RemovePermission</a>.</p><note>
168    /// <p>Each <code>StatementId</code> must be unique.</p>
169    /// </note>
170    pub fn set_statement_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171        self.inner = self.inner.set_statement_id(input);
172        self
173    }
174    /// <p>An identifier string for the external account that you are granting permissions to. If you later want to revoke the permission for this external account, specify this <code>StatementId</code> when you run <a href="https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_RemovePermission.html">RemovePermission</a>.</p><note>
175    /// <p>Each <code>StatementId</code> must be unique.</p>
176    /// </note>
177    pub fn get_statement_id(&self) -> &::std::option::Option<::std::string::String> {
178        self.inner.get_statement_id()
179    }
180    /// <p>This parameter enables you to limit the permission to accounts that fulfill a certain condition, such as being a member of a certain Amazon Web Services organization. For more information about Amazon Web Services Organizations, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_introduction.html">What Is Amazon Web Services Organizations</a> in the <i>Amazon Web Services Organizations User Guide</i>.</p>
181    /// <p>If you specify <code>Condition</code> with an Amazon Web Services organization ID, and specify "*" as the value for <code>Principal</code>, you grant permission to all the accounts in the named organization.</p>
182    /// <p>The <code>Condition</code> is a JSON string which must contain <code>Type</code>, <code>Key</code>, and <code>Value</code> fields.</p>
183    pub fn condition(mut self, input: crate::types::Condition) -> Self {
184        self.inner = self.inner.condition(input);
185        self
186    }
187    /// <p>This parameter enables you to limit the permission to accounts that fulfill a certain condition, such as being a member of a certain Amazon Web Services organization. For more information about Amazon Web Services Organizations, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_introduction.html">What Is Amazon Web Services Organizations</a> in the <i>Amazon Web Services Organizations User Guide</i>.</p>
188    /// <p>If you specify <code>Condition</code> with an Amazon Web Services organization ID, and specify "*" as the value for <code>Principal</code>, you grant permission to all the accounts in the named organization.</p>
189    /// <p>The <code>Condition</code> is a JSON string which must contain <code>Type</code>, <code>Key</code>, and <code>Value</code> fields.</p>
190    pub fn set_condition(mut self, input: ::std::option::Option<crate::types::Condition>) -> Self {
191        self.inner = self.inner.set_condition(input);
192        self
193    }
194    /// <p>This parameter enables you to limit the permission to accounts that fulfill a certain condition, such as being a member of a certain Amazon Web Services organization. For more information about Amazon Web Services Organizations, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_introduction.html">What Is Amazon Web Services Organizations</a> in the <i>Amazon Web Services Organizations User Guide</i>.</p>
195    /// <p>If you specify <code>Condition</code> with an Amazon Web Services organization ID, and specify "*" as the value for <code>Principal</code>, you grant permission to all the accounts in the named organization.</p>
196    /// <p>The <code>Condition</code> is a JSON string which must contain <code>Type</code>, <code>Key</code>, and <code>Value</code> fields.</p>
197    pub fn get_condition(&self) -> &::std::option::Option<crate::types::Condition> {
198        self.inner.get_condition()
199    }
200    /// <p>A JSON string that describes the permission policy statement. You can include a <code>Policy</code> parameter in the request instead of using the <code>StatementId</code>, <code>Action</code>, <code>Principal</code>, or <code>Condition</code> parameters.</p>
201    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
202        self.inner = self.inner.policy(input.into());
203        self
204    }
205    /// <p>A JSON string that describes the permission policy statement. You can include a <code>Policy</code> parameter in the request instead of using the <code>StatementId</code>, <code>Action</code>, <code>Principal</code>, or <code>Condition</code> parameters.</p>
206    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
207        self.inner = self.inner.set_policy(input);
208        self
209    }
210    /// <p>A JSON string that describes the permission policy statement. You can include a <code>Policy</code> parameter in the request instead of using the <code>StatementId</code>, <code>Action</code>, <code>Principal</code>, or <code>Condition</code> parameters.</p>
211    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
212        self.inner.get_policy()
213    }
214}