aws_sdk_evidently/operation/create_segment/
_create_segment_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 CreateSegmentInput {
6    /// <p>A name for the segment.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>The pattern to use for the segment. For more information about pattern syntax, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html"> Segment rule pattern syntax</a>.</p>
9    pub pattern: ::std::option::Option<::std::string::String>,
10    /// <p>An optional description for this segment.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>Assigns one or more tags (key-value pairs) to the segment.</p>
13    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
14    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
15    /// <p>You can associate as many as 50 tags with a segment.</p>
16    /// <p>For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a>.</p>
17    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
18}
19impl CreateSegmentInput {
20    /// <p>A name for the segment.</p>
21    pub fn name(&self) -> ::std::option::Option<&str> {
22        self.name.as_deref()
23    }
24    /// <p>The pattern to use for the segment. For more information about pattern syntax, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html"> Segment rule pattern syntax</a>.</p>
25    pub fn pattern(&self) -> ::std::option::Option<&str> {
26        self.pattern.as_deref()
27    }
28    /// <p>An optional description for this segment.</p>
29    pub fn description(&self) -> ::std::option::Option<&str> {
30        self.description.as_deref()
31    }
32    /// <p>Assigns one or more tags (key-value pairs) to the segment.</p>
33    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
34    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
35    /// <p>You can associate as many as 50 tags with a segment.</p>
36    /// <p>For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a>.</p>
37    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
38        self.tags.as_ref()
39    }
40}
41impl CreateSegmentInput {
42    /// Creates a new builder-style object to manufacture [`CreateSegmentInput`](crate::operation::create_segment::CreateSegmentInput).
43    pub fn builder() -> crate::operation::create_segment::builders::CreateSegmentInputBuilder {
44        crate::operation::create_segment::builders::CreateSegmentInputBuilder::default()
45    }
46}
47
48/// A builder for [`CreateSegmentInput`](crate::operation::create_segment::CreateSegmentInput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct CreateSegmentInputBuilder {
52    pub(crate) name: ::std::option::Option<::std::string::String>,
53    pub(crate) pattern: ::std::option::Option<::std::string::String>,
54    pub(crate) description: ::std::option::Option<::std::string::String>,
55    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
56}
57impl CreateSegmentInputBuilder {
58    /// <p>A name for the segment.</p>
59    /// This field is required.
60    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
61        self.name = ::std::option::Option::Some(input.into());
62        self
63    }
64    /// <p>A name for the segment.</p>
65    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
66        self.name = input;
67        self
68    }
69    /// <p>A name for the segment.</p>
70    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
71        &self.name
72    }
73    /// <p>The pattern to use for the segment. For more information about pattern syntax, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html"> Segment rule pattern syntax</a>.</p>
74    /// This field is required.
75    pub fn pattern(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.pattern = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>The pattern to use for the segment. For more information about pattern syntax, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html"> Segment rule pattern syntax</a>.</p>
80    pub fn set_pattern(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.pattern = input;
82        self
83    }
84    /// <p>The pattern to use for the segment. For more information about pattern syntax, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html"> Segment rule pattern syntax</a>.</p>
85    pub fn get_pattern(&self) -> &::std::option::Option<::std::string::String> {
86        &self.pattern
87    }
88    /// <p>An optional description for this segment.</p>
89    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
90        self.description = ::std::option::Option::Some(input.into());
91        self
92    }
93    /// <p>An optional description for this segment.</p>
94    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
95        self.description = input;
96        self
97    }
98    /// <p>An optional description for this segment.</p>
99    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
100        &self.description
101    }
102    /// Adds a key-value pair to `tags`.
103    ///
104    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
105    ///
106    /// <p>Assigns one or more tags (key-value pairs) to the segment.</p>
107    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
108    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
109    /// <p>You can associate as many as 50 tags with a segment.</p>
110    /// <p>For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a>.</p>
111    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
112        let mut hash_map = self.tags.unwrap_or_default();
113        hash_map.insert(k.into(), v.into());
114        self.tags = ::std::option::Option::Some(hash_map);
115        self
116    }
117    /// <p>Assigns one or more tags (key-value pairs) to the segment.</p>
118    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
119    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
120    /// <p>You can associate as many as 50 tags with a segment.</p>
121    /// <p>For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a>.</p>
122    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
123        self.tags = input;
124        self
125    }
126    /// <p>Assigns one or more tags (key-value pairs) to the segment.</p>
127    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
128    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
129    /// <p>You can associate as many as 50 tags with a segment.</p>
130    /// <p>For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a>.</p>
131    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
132        &self.tags
133    }
134    /// Consumes the builder and constructs a [`CreateSegmentInput`](crate::operation::create_segment::CreateSegmentInput).
135    pub fn build(
136        self,
137    ) -> ::std::result::Result<crate::operation::create_segment::CreateSegmentInput, ::aws_smithy_types::error::operation::BuildError> {
138        ::std::result::Result::Ok(crate::operation::create_segment::CreateSegmentInput {
139            name: self.name,
140            pattern: self.pattern,
141            description: self.description,
142            tags: self.tags,
143        })
144    }
145}