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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>An object containing the <code>ruleName</code> and <code>matchingKeys</code>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Rule {
/// <p>A name for the matching rule.</p>
pub rule_name: ::std::string::String,
/// <p>A list of <code>MatchingKeys</code>. The <code>MatchingKeys</code> must have been defined in the <code>SchemaMapping</code>. Two records are considered to match according to this rule if all of the <code>MatchingKeys</code> match.</p>
pub matching_keys: ::std::vec::Vec<::std::string::String>,
}
impl Rule {
/// <p>A name for the matching rule.</p>
pub fn rule_name(&self) -> &str {
use std::ops::Deref;
self.rule_name.deref()
}
/// <p>A list of <code>MatchingKeys</code>. The <code>MatchingKeys</code> must have been defined in the <code>SchemaMapping</code>. Two records are considered to match according to this rule if all of the <code>MatchingKeys</code> match.</p>
pub fn matching_keys(&self) -> &[::std::string::String] {
use std::ops::Deref;
self.matching_keys.deref()
}
}
impl Rule {
/// Creates a new builder-style object to manufacture [`Rule`](crate::types::Rule).
pub fn builder() -> crate::types::builders::RuleBuilder {
crate::types::builders::RuleBuilder::default()
}
}
/// A builder for [`Rule`](crate::types::Rule).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct RuleBuilder {
pub(crate) rule_name: ::std::option::Option<::std::string::String>,
pub(crate) matching_keys: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl RuleBuilder {
/// <p>A name for the matching rule.</p>
/// This field is required.
pub fn rule_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.rule_name = ::std::option::Option::Some(input.into());
self
}
/// <p>A name for the matching rule.</p>
pub fn set_rule_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.rule_name = input;
self
}
/// <p>A name for the matching rule.</p>
pub fn get_rule_name(&self) -> &::std::option::Option<::std::string::String> {
&self.rule_name
}
/// Appends an item to `matching_keys`.
///
/// To override the contents of this collection use [`set_matching_keys`](Self::set_matching_keys).
///
/// <p>A list of <code>MatchingKeys</code>. The <code>MatchingKeys</code> must have been defined in the <code>SchemaMapping</code>. Two records are considered to match according to this rule if all of the <code>MatchingKeys</code> match.</p>
pub fn matching_keys(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.matching_keys.unwrap_or_default();
v.push(input.into());
self.matching_keys = ::std::option::Option::Some(v);
self
}
/// <p>A list of <code>MatchingKeys</code>. The <code>MatchingKeys</code> must have been defined in the <code>SchemaMapping</code>. Two records are considered to match according to this rule if all of the <code>MatchingKeys</code> match.</p>
pub fn set_matching_keys(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.matching_keys = input;
self
}
/// <p>A list of <code>MatchingKeys</code>. The <code>MatchingKeys</code> must have been defined in the <code>SchemaMapping</code>. Two records are considered to match according to this rule if all of the <code>MatchingKeys</code> match.</p>
pub fn get_matching_keys(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.matching_keys
}
/// Consumes the builder and constructs a [`Rule`](crate::types::Rule).
/// This method will fail if any of the following fields are not set:
/// - [`rule_name`](crate::types::builders::RuleBuilder::rule_name)
/// - [`matching_keys`](crate::types::builders::RuleBuilder::matching_keys)
pub fn build(self) -> ::std::result::Result<crate::types::Rule, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Rule {
rule_name: self.rule_name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"rule_name",
"rule_name was not specified but it is required when building Rule",
)
})?,
matching_keys: self.matching_keys.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"matching_keys",
"matching_keys was not specified but it is required when building Rule",
)
})?,
})
}
}