aws_sdk_elasticloadbalancingv2/operation/create_rule/
_create_rule_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 CreateRuleInput {
6    /// <p>The Amazon Resource Name (ARN) of the listener.</p>
7    pub listener_arn: ::std::option::Option<::std::string::String>,
8    /// <p>The conditions.</p>
9    pub conditions: ::std::option::Option<::std::vec::Vec<crate::types::RuleCondition>>,
10    /// <p>The rule priority. A listener can't have multiple rules with the same priority.</p>
11    pub priority: ::std::option::Option<i32>,
12    /// <p>The actions.</p>
13    pub actions: ::std::option::Option<::std::vec::Vec<crate::types::Action>>,
14    /// <p>The tags to assign to the rule.</p>
15    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
16    /// <p>The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform.</p>
17    pub transforms: ::std::option::Option<::std::vec::Vec<crate::types::RuleTransform>>,
18}
19impl CreateRuleInput {
20    /// <p>The Amazon Resource Name (ARN) of the listener.</p>
21    pub fn listener_arn(&self) -> ::std::option::Option<&str> {
22        self.listener_arn.as_deref()
23    }
24    /// <p>The conditions.</p>
25    ///
26    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.conditions.is_none()`.
27    pub fn conditions(&self) -> &[crate::types::RuleCondition] {
28        self.conditions.as_deref().unwrap_or_default()
29    }
30    /// <p>The rule priority. A listener can't have multiple rules with the same priority.</p>
31    pub fn priority(&self) -> ::std::option::Option<i32> {
32        self.priority
33    }
34    /// <p>The actions.</p>
35    ///
36    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.actions.is_none()`.
37    pub fn actions(&self) -> &[crate::types::Action] {
38        self.actions.as_deref().unwrap_or_default()
39    }
40    /// <p>The tags to assign to the rule.</p>
41    ///
42    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
43    pub fn tags(&self) -> &[crate::types::Tag] {
44        self.tags.as_deref().unwrap_or_default()
45    }
46    /// <p>The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform.</p>
47    ///
48    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.transforms.is_none()`.
49    pub fn transforms(&self) -> &[crate::types::RuleTransform] {
50        self.transforms.as_deref().unwrap_or_default()
51    }
52}
53impl CreateRuleInput {
54    /// Creates a new builder-style object to manufacture [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
55    pub fn builder() -> crate::operation::create_rule::builders::CreateRuleInputBuilder {
56        crate::operation::create_rule::builders::CreateRuleInputBuilder::default()
57    }
58}
59
60/// A builder for [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
61#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
62#[non_exhaustive]
63pub struct CreateRuleInputBuilder {
64    pub(crate) listener_arn: ::std::option::Option<::std::string::String>,
65    pub(crate) conditions: ::std::option::Option<::std::vec::Vec<crate::types::RuleCondition>>,
66    pub(crate) priority: ::std::option::Option<i32>,
67    pub(crate) actions: ::std::option::Option<::std::vec::Vec<crate::types::Action>>,
68    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
69    pub(crate) transforms: ::std::option::Option<::std::vec::Vec<crate::types::RuleTransform>>,
70}
71impl CreateRuleInputBuilder {
72    /// <p>The Amazon Resource Name (ARN) of the listener.</p>
73    /// This field is required.
74    pub fn listener_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
75        self.listener_arn = ::std::option::Option::Some(input.into());
76        self
77    }
78    /// <p>The Amazon Resource Name (ARN) of the listener.</p>
79    pub fn set_listener_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
80        self.listener_arn = input;
81        self
82    }
83    /// <p>The Amazon Resource Name (ARN) of the listener.</p>
84    pub fn get_listener_arn(&self) -> &::std::option::Option<::std::string::String> {
85        &self.listener_arn
86    }
87    /// Appends an item to `conditions`.
88    ///
89    /// To override the contents of this collection use [`set_conditions`](Self::set_conditions).
90    ///
91    /// <p>The conditions.</p>
92    pub fn conditions(mut self, input: crate::types::RuleCondition) -> Self {
93        let mut v = self.conditions.unwrap_or_default();
94        v.push(input);
95        self.conditions = ::std::option::Option::Some(v);
96        self
97    }
98    /// <p>The conditions.</p>
99    pub fn set_conditions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RuleCondition>>) -> Self {
100        self.conditions = input;
101        self
102    }
103    /// <p>The conditions.</p>
104    pub fn get_conditions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RuleCondition>> {
105        &self.conditions
106    }
107    /// <p>The rule priority. A listener can't have multiple rules with the same priority.</p>
108    /// This field is required.
109    pub fn priority(mut self, input: i32) -> Self {
110        self.priority = ::std::option::Option::Some(input);
111        self
112    }
113    /// <p>The rule priority. A listener can't have multiple rules with the same priority.</p>
114    pub fn set_priority(mut self, input: ::std::option::Option<i32>) -> Self {
115        self.priority = input;
116        self
117    }
118    /// <p>The rule priority. A listener can't have multiple rules with the same priority.</p>
119    pub fn get_priority(&self) -> &::std::option::Option<i32> {
120        &self.priority
121    }
122    /// Appends an item to `actions`.
123    ///
124    /// To override the contents of this collection use [`set_actions`](Self::set_actions).
125    ///
126    /// <p>The actions.</p>
127    pub fn actions(mut self, input: crate::types::Action) -> Self {
128        let mut v = self.actions.unwrap_or_default();
129        v.push(input);
130        self.actions = ::std::option::Option::Some(v);
131        self
132    }
133    /// <p>The actions.</p>
134    pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Action>>) -> Self {
135        self.actions = input;
136        self
137    }
138    /// <p>The actions.</p>
139    pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Action>> {
140        &self.actions
141    }
142    /// Appends an item to `tags`.
143    ///
144    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
145    ///
146    /// <p>The tags to assign to the rule.</p>
147    pub fn tags(mut self, input: crate::types::Tag) -> Self {
148        let mut v = self.tags.unwrap_or_default();
149        v.push(input);
150        self.tags = ::std::option::Option::Some(v);
151        self
152    }
153    /// <p>The tags to assign to the rule.</p>
154    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
155        self.tags = input;
156        self
157    }
158    /// <p>The tags to assign to the rule.</p>
159    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
160        &self.tags
161    }
162    /// Appends an item to `transforms`.
163    ///
164    /// To override the contents of this collection use [`set_transforms`](Self::set_transforms).
165    ///
166    /// <p>The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform.</p>
167    pub fn transforms(mut self, input: crate::types::RuleTransform) -> Self {
168        let mut v = self.transforms.unwrap_or_default();
169        v.push(input);
170        self.transforms = ::std::option::Option::Some(v);
171        self
172    }
173    /// <p>The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform.</p>
174    pub fn set_transforms(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RuleTransform>>) -> Self {
175        self.transforms = input;
176        self
177    }
178    /// <p>The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform.</p>
179    pub fn get_transforms(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RuleTransform>> {
180        &self.transforms
181    }
182    /// Consumes the builder and constructs a [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
183    pub fn build(self) -> ::std::result::Result<crate::operation::create_rule::CreateRuleInput, ::aws_smithy_types::error::operation::BuildError> {
184        ::std::result::Result::Ok(crate::operation::create_rule::CreateRuleInput {
185            listener_arn: self.listener_arn,
186            conditions: self.conditions,
187            priority: self.priority,
188            actions: self.actions,
189            tags: self.tags,
190            transforms: self.transforms,
191        })
192    }
193}