aws_sdk_eventbridge/operation/put_permission/
_put_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 PutPermissionInput {
6    /// <p>The name of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
7    pub event_bus_name: ::std::option::Option<::std::string::String>,
8    /// <p>The action that you are enabling the other account to perform.</p>
9    pub action: ::std::option::Option<::std::string::String>,
10    /// <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>
11    /// <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>
12    pub principal: ::std::option::Option<::std::string::String>,
13    /// <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>
14    /// <p>Each <code>StatementId</code> must be unique.</p>
15    /// </note>
16    pub statement_id: ::std::option::Option<::std::string::String>,
17    /// <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>
18    /// <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>
19    /// <p>The <code>Condition</code> is a JSON string which must contain <code>Type</code>, <code>Key</code>, and <code>Value</code> fields.</p>
20    pub condition: ::std::option::Option<crate::types::Condition>,
21    /// <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>
22    pub policy: ::std::option::Option<::std::string::String>,
23}
24impl PutPermissionInput {
25    /// <p>The name of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
26    pub fn event_bus_name(&self) -> ::std::option::Option<&str> {
27        self.event_bus_name.as_deref()
28    }
29    /// <p>The action that you are enabling the other account to perform.</p>
30    pub fn action(&self) -> ::std::option::Option<&str> {
31        self.action.as_deref()
32    }
33    /// <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>
34    /// <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>
35    pub fn principal(&self) -> ::std::option::Option<&str> {
36        self.principal.as_deref()
37    }
38    /// <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>
39    /// <p>Each <code>StatementId</code> must be unique.</p>
40    /// </note>
41    pub fn statement_id(&self) -> ::std::option::Option<&str> {
42        self.statement_id.as_deref()
43    }
44    /// <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>
45    /// <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>
46    /// <p>The <code>Condition</code> is a JSON string which must contain <code>Type</code>, <code>Key</code>, and <code>Value</code> fields.</p>
47    pub fn condition(&self) -> ::std::option::Option<&crate::types::Condition> {
48        self.condition.as_ref()
49    }
50    /// <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>
51    pub fn policy(&self) -> ::std::option::Option<&str> {
52        self.policy.as_deref()
53    }
54}
55impl PutPermissionInput {
56    /// Creates a new builder-style object to manufacture [`PutPermissionInput`](crate::operation::put_permission::PutPermissionInput).
57    pub fn builder() -> crate::operation::put_permission::builders::PutPermissionInputBuilder {
58        crate::operation::put_permission::builders::PutPermissionInputBuilder::default()
59    }
60}
61
62/// A builder for [`PutPermissionInput`](crate::operation::put_permission::PutPermissionInput).
63#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
64#[non_exhaustive]
65pub struct PutPermissionInputBuilder {
66    pub(crate) event_bus_name: ::std::option::Option<::std::string::String>,
67    pub(crate) action: ::std::option::Option<::std::string::String>,
68    pub(crate) principal: ::std::option::Option<::std::string::String>,
69    pub(crate) statement_id: ::std::option::Option<::std::string::String>,
70    pub(crate) condition: ::std::option::Option<crate::types::Condition>,
71    pub(crate) policy: ::std::option::Option<::std::string::String>,
72}
73impl PutPermissionInputBuilder {
74    /// <p>The name of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
75    pub fn event_bus_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.event_bus_name = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>The name of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
80    pub fn set_event_bus_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.event_bus_name = input;
82        self
83    }
84    /// <p>The name of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
85    pub fn get_event_bus_name(&self) -> &::std::option::Option<::std::string::String> {
86        &self.event_bus_name
87    }
88    /// <p>The action that you are enabling the other account to perform.</p>
89    pub fn action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
90        self.action = ::std::option::Option::Some(input.into());
91        self
92    }
93    /// <p>The action that you are enabling the other account to perform.</p>
94    pub fn set_action(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
95        self.action = input;
96        self
97    }
98    /// <p>The action that you are enabling the other account to perform.</p>
99    pub fn get_action(&self) -> &::std::option::Option<::std::string::String> {
100        &self.action
101    }
102    /// <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>
103    /// <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>
104    pub fn principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105        self.principal = ::std::option::Option::Some(input.into());
106        self
107    }
108    /// <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>
109    /// <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>
110    pub fn set_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
111        self.principal = input;
112        self
113    }
114    /// <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>
115    /// <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>
116    pub fn get_principal(&self) -> &::std::option::Option<::std::string::String> {
117        &self.principal
118    }
119    /// <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>
120    /// <p>Each <code>StatementId</code> must be unique.</p>
121    /// </note>
122    pub fn statement_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.statement_id = ::std::option::Option::Some(input.into());
124        self
125    }
126    /// <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>
127    /// <p>Each <code>StatementId</code> must be unique.</p>
128    /// </note>
129    pub fn set_statement_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.statement_id = input;
131        self
132    }
133    /// <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>
134    /// <p>Each <code>StatementId</code> must be unique.</p>
135    /// </note>
136    pub fn get_statement_id(&self) -> &::std::option::Option<::std::string::String> {
137        &self.statement_id
138    }
139    /// <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>
140    /// <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>
141    /// <p>The <code>Condition</code> is a JSON string which must contain <code>Type</code>, <code>Key</code>, and <code>Value</code> fields.</p>
142    pub fn condition(mut self, input: crate::types::Condition) -> Self {
143        self.condition = ::std::option::Option::Some(input);
144        self
145    }
146    /// <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>
147    /// <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>
148    /// <p>The <code>Condition</code> is a JSON string which must contain <code>Type</code>, <code>Key</code>, and <code>Value</code> fields.</p>
149    pub fn set_condition(mut self, input: ::std::option::Option<crate::types::Condition>) -> Self {
150        self.condition = input;
151        self
152    }
153    /// <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>
154    /// <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>
155    /// <p>The <code>Condition</code> is a JSON string which must contain <code>Type</code>, <code>Key</code>, and <code>Value</code> fields.</p>
156    pub fn get_condition(&self) -> &::std::option::Option<crate::types::Condition> {
157        &self.condition
158    }
159    /// <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>
160    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.policy = ::std::option::Option::Some(input.into());
162        self
163    }
164    /// <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>
165    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.policy = input;
167        self
168    }
169    /// <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>
170    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
171        &self.policy
172    }
173    /// Consumes the builder and constructs a [`PutPermissionInput`](crate::operation::put_permission::PutPermissionInput).
174    pub fn build(
175        self,
176    ) -> ::std::result::Result<crate::operation::put_permission::PutPermissionInput, ::aws_smithy_types::error::operation::BuildError> {
177        ::std::result::Result::Ok(crate::operation::put_permission::PutPermissionInput {
178            event_bus_name: self.event_bus_name,
179            action: self.action,
180            principal: self.principal,
181            statement_id: self.statement_id,
182            condition: self.condition,
183            policy: self.policy,
184        })
185    }
186}