aws_sdk_databrew/operation/create_ruleset/
_create_ruleset_input.rs1#[allow(missing_docs)] #[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateRulesetInput {
6 pub name: ::std::option::Option<::std::string::String>,
8 pub description: ::std::option::Option<::std::string::String>,
10 pub target_arn: ::std::option::Option<::std::string::String>,
12 pub rules: ::std::option::Option<::std::vec::Vec<crate::types::Rule>>,
14 pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
16}
17impl CreateRulesetInput {
18 pub fn name(&self) -> ::std::option::Option<&str> {
20 self.name.as_deref()
21 }
22 pub fn description(&self) -> ::std::option::Option<&str> {
24 self.description.as_deref()
25 }
26 pub fn target_arn(&self) -> ::std::option::Option<&str> {
28 self.target_arn.as_deref()
29 }
30 pub fn rules(&self) -> &[crate::types::Rule] {
34 self.rules.as_deref().unwrap_or_default()
35 }
36 pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
38 self.tags.as_ref()
39 }
40}
41impl CreateRulesetInput {
42 pub fn builder() -> crate::operation::create_ruleset::builders::CreateRulesetInputBuilder {
44 crate::operation::create_ruleset::builders::CreateRulesetInputBuilder::default()
45 }
46}
47
48#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct CreateRulesetInputBuilder {
52 pub(crate) name: ::std::option::Option<::std::string::String>,
53 pub(crate) description: ::std::option::Option<::std::string::String>,
54 pub(crate) target_arn: ::std::option::Option<::std::string::String>,
55 pub(crate) rules: ::std::option::Option<::std::vec::Vec<crate::types::Rule>>,
56 pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
57}
58impl CreateRulesetInputBuilder {
59 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62 self.name = ::std::option::Option::Some(input.into());
63 self
64 }
65 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67 self.name = input;
68 self
69 }
70 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
72 &self.name
73 }
74 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76 self.description = ::std::option::Option::Some(input.into());
77 self
78 }
79 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81 self.description = input;
82 self
83 }
84 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
86 &self.description
87 }
88 pub fn target_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91 self.target_arn = ::std::option::Option::Some(input.into());
92 self
93 }
94 pub fn set_target_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96 self.target_arn = input;
97 self
98 }
99 pub fn get_target_arn(&self) -> &::std::option::Option<::std::string::String> {
101 &self.target_arn
102 }
103 pub fn rules(mut self, input: crate::types::Rule) -> Self {
109 let mut v = self.rules.unwrap_or_default();
110 v.push(input);
111 self.rules = ::std::option::Option::Some(v);
112 self
113 }
114 pub fn set_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Rule>>) -> Self {
116 self.rules = input;
117 self
118 }
119 pub fn get_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Rule>> {
121 &self.rules
122 }
123 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
129 let mut hash_map = self.tags.unwrap_or_default();
130 hash_map.insert(k.into(), v.into());
131 self.tags = ::std::option::Option::Some(hash_map);
132 self
133 }
134 pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
136 self.tags = input;
137 self
138 }
139 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
141 &self.tags
142 }
143 pub fn build(
145 self,
146 ) -> ::std::result::Result<crate::operation::create_ruleset::CreateRulesetInput, ::aws_smithy_types::error::operation::BuildError> {
147 ::std::result::Result::Ok(crate::operation::create_ruleset::CreateRulesetInput {
148 name: self.name,
149 description: self.description,
150 target_arn: self.target_arn,
151 rules: self.rules,
152 tags: self.tags,
153 })
154 }
155}