aws_sdk_waf/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>A friendly name or description of the <code>Rule</code>. You can't change the name of a <code>Rule</code> after you create it.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>A friendly name or description for the metrics for this <code>Rule</code>. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name of the metric after you create the <code>Rule</code>.</p>
9    pub metric_name: ::std::option::Option<::std::string::String>,
10    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
11    pub change_token: ::std::option::Option<::std::string::String>,
12    /// <p></p>
13    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
14}
15impl CreateRuleInput {
16    /// <p>A friendly name or description of the <code>Rule</code>. You can't change the name of a <code>Rule</code> after you create it.</p>
17    pub fn name(&self) -> ::std::option::Option<&str> {
18        self.name.as_deref()
19    }
20    /// <p>A friendly name or description for the metrics for this <code>Rule</code>. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name of the metric after you create the <code>Rule</code>.</p>
21    pub fn metric_name(&self) -> ::std::option::Option<&str> {
22        self.metric_name.as_deref()
23    }
24    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
25    pub fn change_token(&self) -> ::std::option::Option<&str> {
26        self.change_token.as_deref()
27    }
28    /// <p></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 `.tags.is_none()`.
31    pub fn tags(&self) -> &[crate::types::Tag] {
32        self.tags.as_deref().unwrap_or_default()
33    }
34}
35impl CreateRuleInput {
36    /// Creates a new builder-style object to manufacture [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
37    pub fn builder() -> crate::operation::create_rule::builders::CreateRuleInputBuilder {
38        crate::operation::create_rule::builders::CreateRuleInputBuilder::default()
39    }
40}
41
42/// A builder for [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
43#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
44#[non_exhaustive]
45pub struct CreateRuleInputBuilder {
46    pub(crate) name: ::std::option::Option<::std::string::String>,
47    pub(crate) metric_name: ::std::option::Option<::std::string::String>,
48    pub(crate) change_token: ::std::option::Option<::std::string::String>,
49    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
50}
51impl CreateRuleInputBuilder {
52    /// <p>A friendly name or description of the <code>Rule</code>. You can't change the name of a <code>Rule</code> after you create it.</p>
53    /// This field is required.
54    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55        self.name = ::std::option::Option::Some(input.into());
56        self
57    }
58    /// <p>A friendly name or description of the <code>Rule</code>. You can't change the name of a <code>Rule</code> after you create it.</p>
59    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60        self.name = input;
61        self
62    }
63    /// <p>A friendly name or description of the <code>Rule</code>. You can't change the name of a <code>Rule</code> after you create it.</p>
64    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
65        &self.name
66    }
67    /// <p>A friendly name or description for the metrics for this <code>Rule</code>. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name of the metric after you create the <code>Rule</code>.</p>
68    /// This field is required.
69    pub fn metric_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
70        self.metric_name = ::std::option::Option::Some(input.into());
71        self
72    }
73    /// <p>A friendly name or description for the metrics for this <code>Rule</code>. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name of the metric after you create the <code>Rule</code>.</p>
74    pub fn set_metric_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
75        self.metric_name = input;
76        self
77    }
78    /// <p>A friendly name or description for the metrics for this <code>Rule</code>. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name of the metric after you create the <code>Rule</code>.</p>
79    pub fn get_metric_name(&self) -> &::std::option::Option<::std::string::String> {
80        &self.metric_name
81    }
82    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
83    /// This field is required.
84    pub fn change_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
85        self.change_token = ::std::option::Option::Some(input.into());
86        self
87    }
88    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
89    pub fn set_change_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
90        self.change_token = input;
91        self
92    }
93    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
94    pub fn get_change_token(&self) -> &::std::option::Option<::std::string::String> {
95        &self.change_token
96    }
97    /// Appends an item to `tags`.
98    ///
99    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
100    ///
101    /// <p></p>
102    pub fn tags(mut self, input: crate::types::Tag) -> Self {
103        let mut v = self.tags.unwrap_or_default();
104        v.push(input);
105        self.tags = ::std::option::Option::Some(v);
106        self
107    }
108    /// <p></p>
109    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
110        self.tags = input;
111        self
112    }
113    /// <p></p>
114    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
115        &self.tags
116    }
117    /// Consumes the builder and constructs a [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
118    pub fn build(self) -> ::std::result::Result<crate::operation::create_rule::CreateRuleInput, ::aws_smithy_types::error::operation::BuildError> {
119        ::std::result::Result::Ok(crate::operation::create_rule::CreateRuleInput {
120            name: self.name,
121            metric_name: self.metric_name,
122            change_token: self.change_token,
123            tags: self.tags,
124        })
125    }
126}