1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>A JSON string which you can use to limit the event bus permissions you are granting to only accounts that fulfill the condition. Currently, the only supported condition is membership in a certain Amazon Web Services organization. The string must contain <code>Type</code>, <code>Key</code>, and <code>Value</code> fields. The <code>Value</code> field specifies the ID of the Amazon Web Services organization. Following is an example value for <code>Condition</code>:</p>
/// <p><code>'{"Type" : "StringEquals", "Key": "aws:PrincipalOrgID", "Value": "o-1234567890"}'</code></p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Condition {
/// <p>Specifies the type of condition. Currently the only supported value is <code>StringEquals</code>.</p>
pub r#type: ::std::string::String,
/// <p>Specifies the key for the condition. Currently the only supported key is <code>aws:PrincipalOrgID</code>.</p>
pub key: ::std::string::String,
/// <p>Specifies the value for the key. Currently, this must be the ID of the organization.</p>
pub value: ::std::string::String,
}
impl Condition {
/// <p>Specifies the type of condition. Currently the only supported value is <code>StringEquals</code>.</p>
pub fn r#type(&self) -> &str {
use std::ops::Deref;
self.r#type.deref()
}
/// <p>Specifies the key for the condition. Currently the only supported key is <code>aws:PrincipalOrgID</code>.</p>
pub fn key(&self) -> &str {
use std::ops::Deref;
self.key.deref()
}
/// <p>Specifies the value for the key. Currently, this must be the ID of the organization.</p>
pub fn value(&self) -> &str {
use std::ops::Deref;
self.value.deref()
}
}
impl Condition {
/// Creates a new builder-style object to manufacture [`Condition`](crate::types::Condition).
pub fn builder() -> crate::types::builders::ConditionBuilder {
crate::types::builders::ConditionBuilder::default()
}
}
/// A builder for [`Condition`](crate::types::Condition).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ConditionBuilder {
pub(crate) r#type: ::std::option::Option<::std::string::String>,
pub(crate) key: ::std::option::Option<::std::string::String>,
pub(crate) value: ::std::option::Option<::std::string::String>,
}
impl ConditionBuilder {
/// <p>Specifies the type of condition. Currently the only supported value is <code>StringEquals</code>.</p>
/// This field is required.
pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.r#type = ::std::option::Option::Some(input.into());
self
}
/// <p>Specifies the type of condition. Currently the only supported value is <code>StringEquals</code>.</p>
pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.r#type = input;
self
}
/// <p>Specifies the type of condition. Currently the only supported value is <code>StringEquals</code>.</p>
pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
&self.r#type
}
/// <p>Specifies the key for the condition. Currently the only supported key is <code>aws:PrincipalOrgID</code>.</p>
/// This field is required.
pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.key = ::std::option::Option::Some(input.into());
self
}
/// <p>Specifies the key for the condition. Currently the only supported key is <code>aws:PrincipalOrgID</code>.</p>
pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.key = input;
self
}
/// <p>Specifies the key for the condition. Currently the only supported key is <code>aws:PrincipalOrgID</code>.</p>
pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
&self.key
}
/// <p>Specifies the value for the key. Currently, this must be the ID of the organization.</p>
/// This field is required.
pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.value = ::std::option::Option::Some(input.into());
self
}
/// <p>Specifies the value for the key. Currently, this must be the ID of the organization.</p>
pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.value = input;
self
}
/// <p>Specifies the value for the key. Currently, this must be the ID of the organization.</p>
pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
&self.value
}
/// Consumes the builder and constructs a [`Condition`](crate::types::Condition).
/// This method will fail if any of the following fields are not set:
/// - [`r#type`](crate::types::builders::ConditionBuilder::type)
/// - [`key`](crate::types::builders::ConditionBuilder::key)
/// - [`value`](crate::types::builders::ConditionBuilder::value)
pub fn build(self) -> ::std::result::Result<crate::types::Condition, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Condition {
r#type: self.r#type.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"r#type",
"r#type was not specified but it is required when building Condition",
)
})?,
key: self.key.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"key",
"key was not specified but it is required when building Condition",
)
})?,
value: self.value.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"value",
"value was not specified but it is required when building Condition",
)
})?,
})
}
}