aws_sdk_elasticloadbalancingv2/operation/modify_rule/
_modify_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 ModifyRuleInput {
6    /// <p>The Amazon Resource Name (ARN) of the rule.</p>
7    pub rule_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 actions.</p>
11    pub actions: ::std::option::Option<::std::vec::Vec<crate::types::Action>>,
12    /// <p>The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform. If you specify <code>Transforms</code>, you can't specify <code>ResetTransforms</code>.</p>
13    pub transforms: ::std::option::Option<::std::vec::Vec<crate::types::RuleTransform>>,
14    /// <p>Indicates whether to remove all transforms from the rule. If you specify <code>ResetTransforms</code>, you can't specify <code>Transforms</code>.</p>
15    pub reset_transforms: ::std::option::Option<bool>,
16}
17impl ModifyRuleInput {
18    /// <p>The Amazon Resource Name (ARN) of the rule.</p>
19    pub fn rule_arn(&self) -> ::std::option::Option<&str> {
20        self.rule_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 actions.</p>
29    ///
30    /// 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()`.
31    pub fn actions(&self) -> &[crate::types::Action] {
32        self.actions.as_deref().unwrap_or_default()
33    }
34    /// <p>The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform. If you specify <code>Transforms</code>, you can't specify <code>ResetTransforms</code>.</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 `.transforms.is_none()`.
37    pub fn transforms(&self) -> &[crate::types::RuleTransform] {
38        self.transforms.as_deref().unwrap_or_default()
39    }
40    /// <p>Indicates whether to remove all transforms from the rule. If you specify <code>ResetTransforms</code>, you can't specify <code>Transforms</code>.</p>
41    pub fn reset_transforms(&self) -> ::std::option::Option<bool> {
42        self.reset_transforms
43    }
44}
45impl ModifyRuleInput {
46    /// Creates a new builder-style object to manufacture [`ModifyRuleInput`](crate::operation::modify_rule::ModifyRuleInput).
47    pub fn builder() -> crate::operation::modify_rule::builders::ModifyRuleInputBuilder {
48        crate::operation::modify_rule::builders::ModifyRuleInputBuilder::default()
49    }
50}
51
52/// A builder for [`ModifyRuleInput`](crate::operation::modify_rule::ModifyRuleInput).
53#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
54#[non_exhaustive]
55pub struct ModifyRuleInputBuilder {
56    pub(crate) rule_arn: ::std::option::Option<::std::string::String>,
57    pub(crate) conditions: ::std::option::Option<::std::vec::Vec<crate::types::RuleCondition>>,
58    pub(crate) actions: ::std::option::Option<::std::vec::Vec<crate::types::Action>>,
59    pub(crate) transforms: ::std::option::Option<::std::vec::Vec<crate::types::RuleTransform>>,
60    pub(crate) reset_transforms: ::std::option::Option<bool>,
61}
62impl ModifyRuleInputBuilder {
63    /// <p>The Amazon Resource Name (ARN) of the rule.</p>
64    /// This field is required.
65    pub fn rule_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
66        self.rule_arn = ::std::option::Option::Some(input.into());
67        self
68    }
69    /// <p>The Amazon Resource Name (ARN) of the rule.</p>
70    pub fn set_rule_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
71        self.rule_arn = input;
72        self
73    }
74    /// <p>The Amazon Resource Name (ARN) of the rule.</p>
75    pub fn get_rule_arn(&self) -> &::std::option::Option<::std::string::String> {
76        &self.rule_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    /// Appends an item to `actions`.
99    ///
100    /// To override the contents of this collection use [`set_actions`](Self::set_actions).
101    ///
102    /// <p>The actions.</p>
103    pub fn actions(mut self, input: crate::types::Action) -> Self {
104        let mut v = self.actions.unwrap_or_default();
105        v.push(input);
106        self.actions = ::std::option::Option::Some(v);
107        self
108    }
109    /// <p>The actions.</p>
110    pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Action>>) -> Self {
111        self.actions = input;
112        self
113    }
114    /// <p>The actions.</p>
115    pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Action>> {
116        &self.actions
117    }
118    /// Appends an item to `transforms`.
119    ///
120    /// To override the contents of this collection use [`set_transforms`](Self::set_transforms).
121    ///
122    /// <p>The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform. If you specify <code>Transforms</code>, you can't specify <code>ResetTransforms</code>.</p>
123    pub fn transforms(mut self, input: crate::types::RuleTransform) -> Self {
124        let mut v = self.transforms.unwrap_or_default();
125        v.push(input);
126        self.transforms = ::std::option::Option::Some(v);
127        self
128    }
129    /// <p>The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform. If you specify <code>Transforms</code>, you can't specify <code>ResetTransforms</code>.</p>
130    pub fn set_transforms(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RuleTransform>>) -> Self {
131        self.transforms = input;
132        self
133    }
134    /// <p>The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform. If you specify <code>Transforms</code>, you can't specify <code>ResetTransforms</code>.</p>
135    pub fn get_transforms(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RuleTransform>> {
136        &self.transforms
137    }
138    /// <p>Indicates whether to remove all transforms from the rule. If you specify <code>ResetTransforms</code>, you can't specify <code>Transforms</code>.</p>
139    pub fn reset_transforms(mut self, input: bool) -> Self {
140        self.reset_transforms = ::std::option::Option::Some(input);
141        self
142    }
143    /// <p>Indicates whether to remove all transforms from the rule. If you specify <code>ResetTransforms</code>, you can't specify <code>Transforms</code>.</p>
144    pub fn set_reset_transforms(mut self, input: ::std::option::Option<bool>) -> Self {
145        self.reset_transforms = input;
146        self
147    }
148    /// <p>Indicates whether to remove all transforms from the rule. If you specify <code>ResetTransforms</code>, you can't specify <code>Transforms</code>.</p>
149    pub fn get_reset_transforms(&self) -> &::std::option::Option<bool> {
150        &self.reset_transforms
151    }
152    /// Consumes the builder and constructs a [`ModifyRuleInput`](crate::operation::modify_rule::ModifyRuleInput).
153    pub fn build(self) -> ::std::result::Result<crate::operation::modify_rule::ModifyRuleInput, ::aws_smithy_types::error::operation::BuildError> {
154        ::std::result::Result::Ok(crate::operation::modify_rule::ModifyRuleInput {
155            rule_arn: self.rule_arn,
156            conditions: self.conditions,
157            actions: self.actions,
158            transforms: self.transforms,
159            reset_transforms: self.reset_transforms,
160        })
161    }
162}