aws_sdk_evidently/operation/update_feature/
_update_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 UpdateFeatureInput {
6    /// <p>The name or ARN of the project that contains the feature to be updated.</p>
7    pub project: ::std::option::Option<::std::string::String>,
8    /// <p>The name of the feature to be updated.</p>
9    pub feature: ::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>To update variation configurations for this feature, or add new ones, specify this structure. In this array, include any variations that you want to add or update. If the array includes a variation name that already exists for this feature, it is updated. If it includes a new variation name, it is added as a new variation.</p>
15    pub add_or_update_variations: ::std::option::Option<::std::vec::Vec<crate::types::VariationConfig>>,
16    /// <p>Removes a variation from the feature. If the variation you specify doesn't exist, then this makes no change and does not report an error.</p>
17    /// <p>This operation fails if you try to remove a variation that is part of an ongoing launch or experiment.</p>
18    pub remove_variations: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
19    /// <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>
20    pub default_variation: ::std::option::Option<::std::string::String>,
21    /// <p>Specified 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>
22    /// <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>
23    pub entity_overrides: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
24}
25impl UpdateFeatureInput {
26    /// <p>The name or ARN of the project that contains the feature to be updated.</p>
27    pub fn project(&self) -> ::std::option::Option<&str> {
28        self.project.as_deref()
29    }
30    /// <p>The name of the feature to be updated.</p>
31    pub fn feature(&self) -> ::std::option::Option<&str> {
32        self.feature.as_deref()
33    }
34    /// <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>
35    pub fn evaluation_strategy(&self) -> ::std::option::Option<&crate::types::FeatureEvaluationStrategy> {
36        self.evaluation_strategy.as_ref()
37    }
38    /// <p>An optional description of the feature.</p>
39    pub fn description(&self) -> ::std::option::Option<&str> {
40        self.description.as_deref()
41    }
42    /// <p>To update variation configurations for this feature, or add new ones, specify this structure. In this array, include any variations that you want to add or update. If the array includes a variation name that already exists for this feature, it is updated. If it includes a new variation name, it is added as a new variation.</p>
43    ///
44    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.add_or_update_variations.is_none()`.
45    pub fn add_or_update_variations(&self) -> &[crate::types::VariationConfig] {
46        self.add_or_update_variations.as_deref().unwrap_or_default()
47    }
48    /// <p>Removes a variation from the feature. If the variation you specify doesn't exist, then this makes no change and does not report an error.</p>
49    /// <p>This operation fails if you try to remove a variation that is part of an ongoing launch or experiment.</p>
50    ///
51    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.remove_variations.is_none()`.
52    pub fn remove_variations(&self) -> &[::std::string::String] {
53        self.remove_variations.as_deref().unwrap_or_default()
54    }
55    /// <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>
56    pub fn default_variation(&self) -> ::std::option::Option<&str> {
57        self.default_variation.as_deref()
58    }
59    /// <p>Specified 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>
60    /// <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>
61    pub fn entity_overrides(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
62        self.entity_overrides.as_ref()
63    }
64}
65impl UpdateFeatureInput {
66    /// Creates a new builder-style object to manufacture [`UpdateFeatureInput`](crate::operation::update_feature::UpdateFeatureInput).
67    pub fn builder() -> crate::operation::update_feature::builders::UpdateFeatureInputBuilder {
68        crate::operation::update_feature::builders::UpdateFeatureInputBuilder::default()
69    }
70}
71
72/// A builder for [`UpdateFeatureInput`](crate::operation::update_feature::UpdateFeatureInput).
73#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
74#[non_exhaustive]
75pub struct UpdateFeatureInputBuilder {
76    pub(crate) project: ::std::option::Option<::std::string::String>,
77    pub(crate) feature: ::std::option::Option<::std::string::String>,
78    pub(crate) evaluation_strategy: ::std::option::Option<crate::types::FeatureEvaluationStrategy>,
79    pub(crate) description: ::std::option::Option<::std::string::String>,
80    pub(crate) add_or_update_variations: ::std::option::Option<::std::vec::Vec<crate::types::VariationConfig>>,
81    pub(crate) remove_variations: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
82    pub(crate) default_variation: ::std::option::Option<::std::string::String>,
83    pub(crate) entity_overrides: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
84}
85impl UpdateFeatureInputBuilder {
86    /// <p>The name or ARN of the project that contains the feature to be updated.</p>
87    /// This field is required.
88    pub fn project(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.project = ::std::option::Option::Some(input.into());
90        self
91    }
92    /// <p>The name or ARN of the project that contains the feature to be updated.</p>
93    pub fn set_project(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.project = input;
95        self
96    }
97    /// <p>The name or ARN of the project that contains the feature to be updated.</p>
98    pub fn get_project(&self) -> &::std::option::Option<::std::string::String> {
99        &self.project
100    }
101    /// <p>The name of the feature to be updated.</p>
102    /// This field is required.
103    pub fn feature(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.feature = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p>The name of the feature to be updated.</p>
108    pub fn set_feature(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.feature = input;
110        self
111    }
112    /// <p>The name of the feature to be updated.</p>
113    pub fn get_feature(&self) -> &::std::option::Option<::std::string::String> {
114        &self.feature
115    }
116    /// <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>
117    pub fn evaluation_strategy(mut self, input: crate::types::FeatureEvaluationStrategy) -> Self {
118        self.evaluation_strategy = ::std::option::Option::Some(input);
119        self
120    }
121    /// <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>
122    pub fn set_evaluation_strategy(mut self, input: ::std::option::Option<crate::types::FeatureEvaluationStrategy>) -> Self {
123        self.evaluation_strategy = input;
124        self
125    }
126    /// <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>
127    pub fn get_evaluation_strategy(&self) -> &::std::option::Option<crate::types::FeatureEvaluationStrategy> {
128        &self.evaluation_strategy
129    }
130    /// <p>An optional description of the feature.</p>
131    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.description = ::std::option::Option::Some(input.into());
133        self
134    }
135    /// <p>An optional description of the feature.</p>
136    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.description = input;
138        self
139    }
140    /// <p>An optional description of the feature.</p>
141    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
142        &self.description
143    }
144    /// Appends an item to `add_or_update_variations`.
145    ///
146    /// To override the contents of this collection use [`set_add_or_update_variations`](Self::set_add_or_update_variations).
147    ///
148    /// <p>To update variation configurations for this feature, or add new ones, specify this structure. In this array, include any variations that you want to add or update. If the array includes a variation name that already exists for this feature, it is updated. If it includes a new variation name, it is added as a new variation.</p>
149    pub fn add_or_update_variations(mut self, input: crate::types::VariationConfig) -> Self {
150        let mut v = self.add_or_update_variations.unwrap_or_default();
151        v.push(input);
152        self.add_or_update_variations = ::std::option::Option::Some(v);
153        self
154    }
155    /// <p>To update variation configurations for this feature, or add new ones, specify this structure. In this array, include any variations that you want to add or update. If the array includes a variation name that already exists for this feature, it is updated. If it includes a new variation name, it is added as a new variation.</p>
156    pub fn set_add_or_update_variations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::VariationConfig>>) -> Self {
157        self.add_or_update_variations = input;
158        self
159    }
160    /// <p>To update variation configurations for this feature, or add new ones, specify this structure. In this array, include any variations that you want to add or update. If the array includes a variation name that already exists for this feature, it is updated. If it includes a new variation name, it is added as a new variation.</p>
161    pub fn get_add_or_update_variations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::VariationConfig>> {
162        &self.add_or_update_variations
163    }
164    /// Appends an item to `remove_variations`.
165    ///
166    /// To override the contents of this collection use [`set_remove_variations`](Self::set_remove_variations).
167    ///
168    /// <p>Removes a variation from the feature. If the variation you specify doesn't exist, then this makes no change and does not report an error.</p>
169    /// <p>This operation fails if you try to remove a variation that is part of an ongoing launch or experiment.</p>
170    pub fn remove_variations(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
171        let mut v = self.remove_variations.unwrap_or_default();
172        v.push(input.into());
173        self.remove_variations = ::std::option::Option::Some(v);
174        self
175    }
176    /// <p>Removes a variation from the feature. If the variation you specify doesn't exist, then this makes no change and does not report an error.</p>
177    /// <p>This operation fails if you try to remove a variation that is part of an ongoing launch or experiment.</p>
178    pub fn set_remove_variations(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
179        self.remove_variations = input;
180        self
181    }
182    /// <p>Removes a variation from the feature. If the variation you specify doesn't exist, then this makes no change and does not report an error.</p>
183    /// <p>This operation fails if you try to remove a variation that is part of an ongoing launch or experiment.</p>
184    pub fn get_remove_variations(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
185        &self.remove_variations
186    }
187    /// <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>
188    pub fn default_variation(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189        self.default_variation = ::std::option::Option::Some(input.into());
190        self
191    }
192    /// <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>
193    pub fn set_default_variation(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
194        self.default_variation = input;
195        self
196    }
197    /// <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>
198    pub fn get_default_variation(&self) -> &::std::option::Option<::std::string::String> {
199        &self.default_variation
200    }
201    /// Adds a key-value pair to `entity_overrides`.
202    ///
203    /// To override the contents of this collection use [`set_entity_overrides`](Self::set_entity_overrides).
204    ///
205    /// <p>Specified 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>
206    /// <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>
207    pub fn entity_overrides(
208        mut self,
209        k: impl ::std::convert::Into<::std::string::String>,
210        v: impl ::std::convert::Into<::std::string::String>,
211    ) -> Self {
212        let mut hash_map = self.entity_overrides.unwrap_or_default();
213        hash_map.insert(k.into(), v.into());
214        self.entity_overrides = ::std::option::Option::Some(hash_map);
215        self
216    }
217    /// <p>Specified 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>
218    /// <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>
219    pub fn set_entity_overrides(
220        mut self,
221        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
222    ) -> Self {
223        self.entity_overrides = input;
224        self
225    }
226    /// <p>Specified 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>
227    /// <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>
228    pub fn get_entity_overrides(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
229        &self.entity_overrides
230    }
231    /// Consumes the builder and constructs a [`UpdateFeatureInput`](crate::operation::update_feature::UpdateFeatureInput).
232    pub fn build(
233        self,
234    ) -> ::std::result::Result<crate::operation::update_feature::UpdateFeatureInput, ::aws_smithy_types::error::operation::BuildError> {
235        ::std::result::Result::Ok(crate::operation::update_feature::UpdateFeatureInput {
236            project: self.project,
237            feature: self.feature,
238            evaluation_strategy: self.evaluation_strategy,
239            description: self.description,
240            add_or_update_variations: self.add_or_update_variations,
241            remove_variations: self.remove_variations,
242            default_variation: self.default_variation,
243            entity_overrides: self.entity_overrides,
244        })
245    }
246}