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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Contains an array of triplets made up of a condition type (such as <code>StringEquals</code>), a key, and a value. Used to filter resources using their tags and assign them to a backup plan. Case sensitive.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Condition {
/// <p>An operation applied to a key-value pair used to assign resources to your backup plan. Condition only supports <code>StringEquals</code>. For more flexible assignment options, including <code>StringLike</code> and the ability to exclude resources from your backup plan, use <code>Conditions</code> (with an "s" on the end) for your <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/API_BackupSelection.html"> <code>BackupSelection</code> </a>.</p>
pub condition_type: crate::types::ConditionType,
/// <p>The key in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Department</code> is the key.</p>
pub condition_key: ::std::string::String,
/// <p>The value in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Accounting</code> is the value.</p>
pub condition_value: ::std::string::String,
}
impl Condition {
/// <p>An operation applied to a key-value pair used to assign resources to your backup plan. Condition only supports <code>StringEquals</code>. For more flexible assignment options, including <code>StringLike</code> and the ability to exclude resources from your backup plan, use <code>Conditions</code> (with an "s" on the end) for your <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/API_BackupSelection.html"> <code>BackupSelection</code> </a>.</p>
pub fn condition_type(&self) -> &crate::types::ConditionType {
&self.condition_type
}
/// <p>The key in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Department</code> is the key.</p>
pub fn condition_key(&self) -> &str {
use std::ops::Deref;
self.condition_key.deref()
}
/// <p>The value in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Accounting</code> is the value.</p>
pub fn condition_value(&self) -> &str {
use std::ops::Deref;
self.condition_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) condition_type: ::std::option::Option<crate::types::ConditionType>,
pub(crate) condition_key: ::std::option::Option<::std::string::String>,
pub(crate) condition_value: ::std::option::Option<::std::string::String>,
}
impl ConditionBuilder {
/// <p>An operation applied to a key-value pair used to assign resources to your backup plan. Condition only supports <code>StringEquals</code>. For more flexible assignment options, including <code>StringLike</code> and the ability to exclude resources from your backup plan, use <code>Conditions</code> (with an "s" on the end) for your <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/API_BackupSelection.html"> <code>BackupSelection</code> </a>.</p>
/// This field is required.
pub fn condition_type(mut self, input: crate::types::ConditionType) -> Self {
self.condition_type = ::std::option::Option::Some(input);
self
}
/// <p>An operation applied to a key-value pair used to assign resources to your backup plan. Condition only supports <code>StringEquals</code>. For more flexible assignment options, including <code>StringLike</code> and the ability to exclude resources from your backup plan, use <code>Conditions</code> (with an "s" on the end) for your <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/API_BackupSelection.html"> <code>BackupSelection</code> </a>.</p>
pub fn set_condition_type(mut self, input: ::std::option::Option<crate::types::ConditionType>) -> Self {
self.condition_type = input;
self
}
/// <p>An operation applied to a key-value pair used to assign resources to your backup plan. Condition only supports <code>StringEquals</code>. For more flexible assignment options, including <code>StringLike</code> and the ability to exclude resources from your backup plan, use <code>Conditions</code> (with an "s" on the end) for your <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/API_BackupSelection.html"> <code>BackupSelection</code> </a>.</p>
pub fn get_condition_type(&self) -> &::std::option::Option<crate::types::ConditionType> {
&self.condition_type
}
/// <p>The key in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Department</code> is the key.</p>
/// This field is required.
pub fn condition_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.condition_key = ::std::option::Option::Some(input.into());
self
}
/// <p>The key in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Department</code> is the key.</p>
pub fn set_condition_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.condition_key = input;
self
}
/// <p>The key in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Department</code> is the key.</p>
pub fn get_condition_key(&self) -> &::std::option::Option<::std::string::String> {
&self.condition_key
}
/// <p>The value in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Accounting</code> is the value.</p>
/// This field is required.
pub fn condition_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.condition_value = ::std::option::Option::Some(input.into());
self
}
/// <p>The value in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Accounting</code> is the value.</p>
pub fn set_condition_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.condition_value = input;
self
}
/// <p>The value in a key-value pair. For example, in the tag <code>Department: Accounting</code>, <code>Accounting</code> is the value.</p>
pub fn get_condition_value(&self) -> &::std::option::Option<::std::string::String> {
&self.condition_value
}
/// Consumes the builder and constructs a [`Condition`](crate::types::Condition).
/// This method will fail if any of the following fields are not set:
/// - [`condition_type`](crate::types::builders::ConditionBuilder::condition_type)
/// - [`condition_key`](crate::types::builders::ConditionBuilder::condition_key)
/// - [`condition_value`](crate::types::builders::ConditionBuilder::condition_value)
pub fn build(self) -> ::std::result::Result<crate::types::Condition, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Condition {
condition_type: self.condition_type.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"condition_type",
"condition_type was not specified but it is required when building Condition",
)
})?,
condition_key: self.condition_key.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"condition_key",
"condition_key was not specified but it is required when building Condition",
)
})?,
condition_value: self.condition_value.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"condition_value",
"condition_value was not specified but it is required when building Condition",
)
})?,
})
}
}