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}
17impl CreateRuleInput {
18    /// <p>The Amazon Resource Name (ARN) of the listener.</p>
19    pub fn listener_arn(&self) -> ::std::option::Option<&str> {
20        self.listener_arn.as_deref()
21    }
22    /// <p>The conditions.</p>
23    ///
24    /// 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()`.
25    pub fn conditions(&self) -> &[crate::types::RuleCondition] {
26        self.conditions.as_deref().unwrap_or_default()
27    }
28    /// <p>The rule priority. A listener can't have multiple rules with the same priority.</p>
29    pub fn priority(&self) -> ::std::option::Option<i32> {
30        self.priority
31    }
32    /// <p>The actions.</p>
33    ///
34    /// 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()`.
35    pub fn actions(&self) -> &[crate::types::Action] {
36        self.actions.as_deref().unwrap_or_default()
37    }
38    /// <p>The tags to assign to the rule.</p>
39    ///
40    /// 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()`.
41    pub fn tags(&self) -> &[crate::types::Tag] {
42        self.tags.as_deref().unwrap_or_default()
43    }
44}
45impl CreateRuleInput {
46    /// Creates a new builder-style object to manufacture [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
47    pub fn builder() -> crate::operation::create_rule::builders::CreateRuleInputBuilder {
48        crate::operation::create_rule::builders::CreateRuleInputBuilder::default()
49    }
50}
51
52/// A builder for [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
53#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
54#[non_exhaustive]
55pub struct CreateRuleInputBuilder {
56    pub(crate) listener_arn: ::std::option::Option<::std::string::String>,
57    pub(crate) conditions: ::std::option::Option<::std::vec::Vec<crate::types::RuleCondition>>,
58    pub(crate) priority: ::std::option::Option<i32>,
59    pub(crate) actions: ::std::option::Option<::std::vec::Vec<crate::types::Action>>,
60    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
61}
62impl CreateRuleInputBuilder {
63    /// <p>The Amazon Resource Name (ARN) of the listener.</p>
64    /// This field is required.
65    pub fn listener_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
66        self.listener_arn = ::std::option::Option::Some(input.into());
67        self
68    }
69    /// <p>The Amazon Resource Name (ARN) of the listener.</p>
70    pub fn set_listener_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
71        self.listener_arn = input;
72        self
73    }
74    /// <p>The Amazon Resource Name (ARN) of the listener.</p>
75    pub fn get_listener_arn(&self) -> &::std::option::Option<::std::string::String> {
76        &self.listener_arn
77    }
78    /// Appends an item to `conditions`.
79    ///
80    /// To override the contents of this collection use [`set_conditions`](Self::set_conditions).
81    ///
82    /// <p>The conditions.</p>
83    pub fn conditions(mut self, input: crate::types::RuleCondition) -> Self {
84        let mut v = self.conditions.unwrap_or_default();
85        v.push(input);
86        self.conditions = ::std::option::Option::Some(v);
87        self
88    }
89    /// <p>The conditions.</p>
90    pub fn set_conditions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RuleCondition>>) -> Self {
91        self.conditions = input;
92        self
93    }
94    /// <p>The conditions.</p>
95    pub fn get_conditions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RuleCondition>> {
96        &self.conditions
97    }
98    /// <p>The rule priority. A listener can't have multiple rules with the same priority.</p>
99    /// This field is required.
100    pub fn priority(mut self, input: i32) -> Self {
101        self.priority = ::std::option::Option::Some(input);
102        self
103    }
104    /// <p>The rule priority. A listener can't have multiple rules with the same priority.</p>
105    pub fn set_priority(mut self, input: ::std::option::Option<i32>) -> Self {
106        self.priority = input;
107        self
108    }
109    /// <p>The rule priority. A listener can't have multiple rules with the same priority.</p>
110    pub fn get_priority(&self) -> &::std::option::Option<i32> {
111        &self.priority
112    }
113    /// Appends an item to `actions`.
114    ///
115    /// To override the contents of this collection use [`set_actions`](Self::set_actions).
116    ///
117    /// <p>The actions.</p>
118    pub fn actions(mut self, input: crate::types::Action) -> Self {
119        let mut v = self.actions.unwrap_or_default();
120        v.push(input);
121        self.actions = ::std::option::Option::Some(v);
122        self
123    }
124    /// <p>The actions.</p>
125    pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Action>>) -> Self {
126        self.actions = input;
127        self
128    }
129    /// <p>The actions.</p>
130    pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Action>> {
131        &self.actions
132    }
133    /// Appends an item to `tags`.
134    ///
135    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
136    ///
137    /// <p>The tags to assign to the rule.</p>
138    pub fn tags(mut self, input: crate::types::Tag) -> Self {
139        let mut v = self.tags.unwrap_or_default();
140        v.push(input);
141        self.tags = ::std::option::Option::Some(v);
142        self
143    }
144    /// <p>The tags to assign to the rule.</p>
145    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
146        self.tags = input;
147        self
148    }
149    /// <p>The tags to assign to the rule.</p>
150    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
151        &self.tags
152    }
153    /// Consumes the builder and constructs a [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
154    pub fn build(self) -> ::std::result::Result<crate::operation::create_rule::CreateRuleInput, ::aws_smithy_types::error::operation::BuildError> {
155        ::std::result::Result::Ok(crate::operation::create_rule::CreateRuleInput {
156            listener_arn: self.listener_arn,
157            conditions: self.conditions,
158            priority: self.priority,
159            actions: self.actions,
160            tags: self.tags,
161        })
162    }
163}