aws_sdk_evidently/operation/create_feature/
_create_feature_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 CreateFeatureInput {
6    /// <p>The name or ARN of the project that is to contain the new feature.</p>
7    pub project: ::std::option::Option<::std::string::String>,
8    /// <p>The name for the new feature.</p>
9    pub name: ::std::option::Option<::std::string::String>,
10    /// <p>Specify <code>ALL_RULES</code> to activate the traffic allocation specified by any ongoing launches or experiments. Specify <code>DEFAULT_VARIATION</code> to serve the default variation to all users instead.</p>
11    pub evaluation_strategy: ::std::option::Option<crate::types::FeatureEvaluationStrategy>,
12    /// <p>An optional description of the feature.</p>
13    pub description: ::std::option::Option<::std::string::String>,
14    /// <p>An array of structures that contain the configuration of the feature's different variations.</p>
15    pub variations: ::std::option::Option<::std::vec::Vec<crate::types::VariationConfig>>,
16    /// <p>The name of the variation to use as the default variation. The default variation is served to users who are not allocated to any ongoing launches or experiments of this feature.</p>
17    /// <p>This variation must also be listed in the <code>variations</code> structure.</p>
18    /// <p>If you omit <code>defaultVariation</code>, the first variation listed in the <code>variations</code> structure is used as the default variation.</p>
19    pub default_variation: ::std::option::Option<::std::string::String>,
20    /// <p>Assigns one or more tags (key-value pairs) to the feature.</p>
21    /// <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>
22    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
23    /// <p>You can associate as many as 50 tags with a feature.</p>
24    /// <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>
25    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
26    /// <p>Specify users that should always be served a specific variation of a feature. Each user is specified by a key-value pair . For each key, specify a user by entering their user ID, account ID, or some other identifier. For the value, specify the name of the variation that they are to be served.</p>
27    /// <p>This parameter is limited to 2500 overrides or a total of 40KB. The 40KB limit includes an overhead of 6 bytes per override.</p>
28    pub entity_overrides: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
29}
30impl CreateFeatureInput {
31    /// <p>The name or ARN of the project that is to contain the new feature.</p>
32    pub fn project(&self) -> ::std::option::Option<&str> {
33        self.project.as_deref()
34    }
35    /// <p>The name for the new feature.</p>
36    pub fn name(&self) -> ::std::option::Option<&str> {
37        self.name.as_deref()
38    }
39    /// <p>Specify <code>ALL_RULES</code> to activate the traffic allocation specified by any ongoing launches or experiments. Specify <code>DEFAULT_VARIATION</code> to serve the default variation to all users instead.</p>
40    pub fn evaluation_strategy(&self) -> ::std::option::Option<&crate::types::FeatureEvaluationStrategy> {
41        self.evaluation_strategy.as_ref()
42    }
43    /// <p>An optional description of the feature.</p>
44    pub fn description(&self) -> ::std::option::Option<&str> {
45        self.description.as_deref()
46    }
47    /// <p>An array of structures that contain the configuration of the feature's different variations.</p>
48    ///
49    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.variations.is_none()`.
50    pub fn variations(&self) -> &[crate::types::VariationConfig] {
51        self.variations.as_deref().unwrap_or_default()
52    }
53    /// <p>The name of the variation to use as the default variation. The default variation is served to users who are not allocated to any ongoing launches or experiments of this feature.</p>
54    /// <p>This variation must also be listed in the <code>variations</code> structure.</p>
55    /// <p>If you omit <code>defaultVariation</code>, the first variation listed in the <code>variations</code> structure is used as the default variation.</p>
56    pub fn default_variation(&self) -> ::std::option::Option<&str> {
57        self.default_variation.as_deref()
58    }
59    /// <p>Assigns one or more tags (key-value pairs) to the feature.</p>
60    /// <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>
61    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
62    /// <p>You can associate as many as 50 tags with a feature.</p>
63    /// <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>
64    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
65        self.tags.as_ref()
66    }
67    /// <p>Specify users that should always be served a specific variation of a feature. Each user is specified by a key-value pair . For each key, specify a user by entering their user ID, account ID, or some other identifier. For the value, specify the name of the variation that they are to be served.</p>
68    /// <p>This parameter is limited to 2500 overrides or a total of 40KB. The 40KB limit includes an overhead of 6 bytes per override.</p>
69    pub fn entity_overrides(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
70        self.entity_overrides.as_ref()
71    }
72}
73impl CreateFeatureInput {
74    /// Creates a new builder-style object to manufacture [`CreateFeatureInput`](crate::operation::create_feature::CreateFeatureInput).
75    pub fn builder() -> crate::operation::create_feature::builders::CreateFeatureInputBuilder {
76        crate::operation::create_feature::builders::CreateFeatureInputBuilder::default()
77    }
78}
79
80/// A builder for [`CreateFeatureInput`](crate::operation::create_feature::CreateFeatureInput).
81#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
82#[non_exhaustive]
83pub struct CreateFeatureInputBuilder {
84    pub(crate) project: ::std::option::Option<::std::string::String>,
85    pub(crate) name: ::std::option::Option<::std::string::String>,
86    pub(crate) evaluation_strategy: ::std::option::Option<crate::types::FeatureEvaluationStrategy>,
87    pub(crate) description: ::std::option::Option<::std::string::String>,
88    pub(crate) variations: ::std::option::Option<::std::vec::Vec<crate::types::VariationConfig>>,
89    pub(crate) default_variation: ::std::option::Option<::std::string::String>,
90    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
91    pub(crate) entity_overrides: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
92}
93impl CreateFeatureInputBuilder {
94    /// <p>The name or ARN of the project that is to contain the new feature.</p>
95    /// This field is required.
96    pub fn project(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        self.project = ::std::option::Option::Some(input.into());
98        self
99    }
100    /// <p>The name or ARN of the project that is to contain the new feature.</p>
101    pub fn set_project(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102        self.project = input;
103        self
104    }
105    /// <p>The name or ARN of the project that is to contain the new feature.</p>
106    pub fn get_project(&self) -> &::std::option::Option<::std::string::String> {
107        &self.project
108    }
109    /// <p>The name for the new feature.</p>
110    /// This field is required.
111    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
112        self.name = ::std::option::Option::Some(input.into());
113        self
114    }
115    /// <p>The name for the new feature.</p>
116    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
117        self.name = input;
118        self
119    }
120    /// <p>The name for the new feature.</p>
121    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
122        &self.name
123    }
124    /// <p>Specify <code>ALL_RULES</code> to activate the traffic allocation specified by any ongoing launches or experiments. Specify <code>DEFAULT_VARIATION</code> to serve the default variation to all users instead.</p>
125    pub fn evaluation_strategy(mut self, input: crate::types::FeatureEvaluationStrategy) -> Self {
126        self.evaluation_strategy = ::std::option::Option::Some(input);
127        self
128    }
129    /// <p>Specify <code>ALL_RULES</code> to activate the traffic allocation specified by any ongoing launches or experiments. Specify <code>DEFAULT_VARIATION</code> to serve the default variation to all users instead.</p>
130    pub fn set_evaluation_strategy(mut self, input: ::std::option::Option<crate::types::FeatureEvaluationStrategy>) -> Self {
131        self.evaluation_strategy = input;
132        self
133    }
134    /// <p>Specify <code>ALL_RULES</code> to activate the traffic allocation specified by any ongoing launches or experiments. Specify <code>DEFAULT_VARIATION</code> to serve the default variation to all users instead.</p>
135    pub fn get_evaluation_strategy(&self) -> &::std::option::Option<crate::types::FeatureEvaluationStrategy> {
136        &self.evaluation_strategy
137    }
138    /// <p>An optional description of the feature.</p>
139    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140        self.description = ::std::option::Option::Some(input.into());
141        self
142    }
143    /// <p>An optional description of the feature.</p>
144    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
145        self.description = input;
146        self
147    }
148    /// <p>An optional description of the feature.</p>
149    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
150        &self.description
151    }
152    /// Appends an item to `variations`.
153    ///
154    /// To override the contents of this collection use [`set_variations`](Self::set_variations).
155    ///
156    /// <p>An array of structures that contain the configuration of the feature's different variations.</p>
157    pub fn variations(mut self, input: crate::types::VariationConfig) -> Self {
158        let mut v = self.variations.unwrap_or_default();
159        v.push(input);
160        self.variations = ::std::option::Option::Some(v);
161        self
162    }
163    /// <p>An array of structures that contain the configuration of the feature's different variations.</p>
164    pub fn set_variations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::VariationConfig>>) -> Self {
165        self.variations = input;
166        self
167    }
168    /// <p>An array of structures that contain the configuration of the feature's different variations.</p>
169    pub fn get_variations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::VariationConfig>> {
170        &self.variations
171    }
172    /// <p>The name of the variation to use as the default variation. The default variation is served to users who are not allocated to any ongoing launches or experiments of this feature.</p>
173    /// <p>This variation must also be listed in the <code>variations</code> structure.</p>
174    /// <p>If you omit <code>defaultVariation</code>, the first variation listed in the <code>variations</code> structure is used as the default variation.</p>
175    pub fn default_variation(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176        self.default_variation = ::std::option::Option::Some(input.into());
177        self
178    }
179    /// <p>The name of the variation to use as the default variation. The default variation is served to users who are not allocated to any ongoing launches or experiments of this feature.</p>
180    /// <p>This variation must also be listed in the <code>variations</code> structure.</p>
181    /// <p>If you omit <code>defaultVariation</code>, the first variation listed in the <code>variations</code> structure is used as the default variation.</p>
182    pub fn set_default_variation(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
183        self.default_variation = input;
184        self
185    }
186    /// <p>The name of the variation to use as the default variation. The default variation is served to users who are not allocated to any ongoing launches or experiments of this feature.</p>
187    /// <p>This variation must also be listed in the <code>variations</code> structure.</p>
188    /// <p>If you omit <code>defaultVariation</code>, the first variation listed in the <code>variations</code> structure is used as the default variation.</p>
189    pub fn get_default_variation(&self) -> &::std::option::Option<::std::string::String> {
190        &self.default_variation
191    }
192    /// Adds a key-value pair to `tags`.
193    ///
194    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
195    ///
196    /// <p>Assigns one or more tags (key-value pairs) to the feature.</p>
197    /// <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>
198    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
199    /// <p>You can associate as many as 50 tags with a feature.</p>
200    /// <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>
201    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
202        let mut hash_map = self.tags.unwrap_or_default();
203        hash_map.insert(k.into(), v.into());
204        self.tags = ::std::option::Option::Some(hash_map);
205        self
206    }
207    /// <p>Assigns one or more tags (key-value pairs) to the feature.</p>
208    /// <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>
209    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
210    /// <p>You can associate as many as 50 tags with a feature.</p>
211    /// <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>
212    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
213        self.tags = input;
214        self
215    }
216    /// <p>Assigns one or more tags (key-value pairs) to the feature.</p>
217    /// <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>
218    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
219    /// <p>You can associate as many as 50 tags with a feature.</p>
220    /// <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>
221    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
222        &self.tags
223    }
224    /// Adds a key-value pair to `entity_overrides`.
225    ///
226    /// To override the contents of this collection use [`set_entity_overrides`](Self::set_entity_overrides).
227    ///
228    /// <p>Specify users that should always be served a specific variation of a feature. Each user is specified by a key-value pair . For each key, specify a user by entering their user ID, account ID, or some other identifier. For the value, specify the name of the variation that they are to be served.</p>
229    /// <p>This parameter is limited to 2500 overrides or a total of 40KB. The 40KB limit includes an overhead of 6 bytes per override.</p>
230    pub fn entity_overrides(
231        mut self,
232        k: impl ::std::convert::Into<::std::string::String>,
233        v: impl ::std::convert::Into<::std::string::String>,
234    ) -> Self {
235        let mut hash_map = self.entity_overrides.unwrap_or_default();
236        hash_map.insert(k.into(), v.into());
237        self.entity_overrides = ::std::option::Option::Some(hash_map);
238        self
239    }
240    /// <p>Specify users that should always be served a specific variation of a feature. Each user is specified by a key-value pair . For each key, specify a user by entering their user ID, account ID, or some other identifier. For the value, specify the name of the variation that they are to be served.</p>
241    /// <p>This parameter is limited to 2500 overrides or a total of 40KB. The 40KB limit includes an overhead of 6 bytes per override.</p>
242    pub fn set_entity_overrides(
243        mut self,
244        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
245    ) -> Self {
246        self.entity_overrides = input;
247        self
248    }
249    /// <p>Specify users that should always be served a specific variation of a feature. Each user is specified by a key-value pair . For each key, specify a user by entering their user ID, account ID, or some other identifier. For the value, specify the name of the variation that they are to be served.</p>
250    /// <p>This parameter is limited to 2500 overrides or a total of 40KB. The 40KB limit includes an overhead of 6 bytes per override.</p>
251    pub fn get_entity_overrides(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
252        &self.entity_overrides
253    }
254    /// Consumes the builder and constructs a [`CreateFeatureInput`](crate::operation::create_feature::CreateFeatureInput).
255    pub fn build(
256        self,
257    ) -> ::std::result::Result<crate::operation::create_feature::CreateFeatureInput, ::aws_smithy_types::error::operation::BuildError> {
258        ::std::result::Result::Ok(crate::operation::create_feature::CreateFeatureInput {
259            project: self.project,
260            name: self.name,
261            evaluation_strategy: self.evaluation_strategy,
262            description: self.description,
263            variations: self.variations,
264            default_variation: self.default_variation,
265            tags: self.tags,
266            entity_overrides: self.entity_overrides,
267        })
268    }
269}