aws_sdk_evidently/operation/create_feature/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_feature::_create_feature_output::CreateFeatureOutputBuilder;
3
4pub use crate::operation::create_feature::_create_feature_input::CreateFeatureInputBuilder;
5
6impl crate::operation::create_feature::builders::CreateFeatureInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_feature::CreateFeatureOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_feature::CreateFeatureError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_feature();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateFeature`.
24///
25/// <p>Creates an Evidently <i>feature</i> that you want to launch or test. You can define up to five variations of a feature, and use these variations in your launches and experiments. A feature must be created in a project. For information about creating a project, see <a href="https://docs.aws.amazon.com/cloudwatchevidently/latest/APIReference/API_CreateProject.html">CreateProject</a>.</p>
26/// <p>Don't use this operation to update an existing feature. Instead, use <a href="https://docs.aws.amazon.com/cloudwatchevidently/latest/APIReference/API_UpdateFeature.html">UpdateFeature</a>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateFeatureFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::create_feature::builders::CreateFeatureInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::create_feature::CreateFeatureOutput,
36        crate::operation::create_feature::CreateFeatureError,
37    > for CreateFeatureFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::create_feature::CreateFeatureOutput,
45            crate::operation::create_feature::CreateFeatureError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl CreateFeatureFluentBuilder {
52    /// Creates a new `CreateFeatureFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the CreateFeature as a reference.
61    pub fn as_input(&self) -> &crate::operation::create_feature::builders::CreateFeatureInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::create_feature::CreateFeatureOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::create_feature::CreateFeatureError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::create_feature::CreateFeature::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::create_feature::CreateFeature::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::create_feature::CreateFeatureOutput,
98        crate::operation::create_feature::CreateFeatureError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The name or ARN of the project that is to contain the new feature.</p>
113    pub fn project(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.project(input.into());
115        self
116    }
117    /// <p>The name or ARN of the project that is to contain the new feature.</p>
118    pub fn set_project(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_project(input);
120        self
121    }
122    /// <p>The name or ARN of the project that is to contain the new feature.</p>
123    pub fn get_project(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_project()
125    }
126    /// <p>The name for the new feature.</p>
127    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.name(input.into());
129        self
130    }
131    /// <p>The name for the new feature.</p>
132    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_name(input);
134        self
135    }
136    /// <p>The name for the new feature.</p>
137    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_name()
139    }
140    /// <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>
141    pub fn evaluation_strategy(mut self, input: crate::types::FeatureEvaluationStrategy) -> Self {
142        self.inner = self.inner.evaluation_strategy(input);
143        self
144    }
145    /// <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>
146    pub fn set_evaluation_strategy(mut self, input: ::std::option::Option<crate::types::FeatureEvaluationStrategy>) -> Self {
147        self.inner = self.inner.set_evaluation_strategy(input);
148        self
149    }
150    /// <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>
151    pub fn get_evaluation_strategy(&self) -> &::std::option::Option<crate::types::FeatureEvaluationStrategy> {
152        self.inner.get_evaluation_strategy()
153    }
154    /// <p>An optional description of the feature.</p>
155    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.inner = self.inner.description(input.into());
157        self
158    }
159    /// <p>An optional description of the feature.</p>
160    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161        self.inner = self.inner.set_description(input);
162        self
163    }
164    /// <p>An optional description of the feature.</p>
165    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
166        self.inner.get_description()
167    }
168    ///
169    /// Appends an item to `variations`.
170    ///
171    /// To override the contents of this collection use [`set_variations`](Self::set_variations).
172    ///
173    /// <p>An array of structures that contain the configuration of the feature's different variations.</p>
174    pub fn variations(mut self, input: crate::types::VariationConfig) -> Self {
175        self.inner = self.inner.variations(input);
176        self
177    }
178    /// <p>An array of structures that contain the configuration of the feature's different variations.</p>
179    pub fn set_variations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::VariationConfig>>) -> Self {
180        self.inner = self.inner.set_variations(input);
181        self
182    }
183    /// <p>An array of structures that contain the configuration of the feature's different variations.</p>
184    pub fn get_variations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::VariationConfig>> {
185        self.inner.get_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    /// <p>This variation must also be listed in the <code>variations</code> structure.</p>
189    /// <p>If you omit <code>defaultVariation</code>, the first variation listed in the <code>variations</code> structure is used as the default variation.</p>
190    pub fn default_variation(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.inner = self.inner.default_variation(input.into());
192        self
193    }
194    /// <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>
195    /// <p>This variation must also be listed in the <code>variations</code> structure.</p>
196    /// <p>If you omit <code>defaultVariation</code>, the first variation listed in the <code>variations</code> structure is used as the default variation.</p>
197    pub fn set_default_variation(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
198        self.inner = self.inner.set_default_variation(input);
199        self
200    }
201    /// <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>
202    /// <p>This variation must also be listed in the <code>variations</code> structure.</p>
203    /// <p>If you omit <code>defaultVariation</code>, the first variation listed in the <code>variations</code> structure is used as the default variation.</p>
204    pub fn get_default_variation(&self) -> &::std::option::Option<::std::string::String> {
205        self.inner.get_default_variation()
206    }
207    ///
208    /// Adds a key-value pair to `tags`.
209    ///
210    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
211    ///
212    /// <p>Assigns one or more tags (key-value pairs) to the feature.</p>
213    /// <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>
214    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
215    /// <p>You can associate as many as 50 tags with a feature.</p>
216    /// <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>
217    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
218        self.inner = self.inner.tags(k.into(), v.into());
219        self
220    }
221    /// <p>Assigns one or more tags (key-value pairs) to the feature.</p>
222    /// <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>
223    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
224    /// <p>You can associate as many as 50 tags with a feature.</p>
225    /// <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>
226    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
227        self.inner = self.inner.set_tags(input);
228        self
229    }
230    /// <p>Assigns one or more tags (key-value pairs) to the feature.</p>
231    /// <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>
232    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
233    /// <p>You can associate as many as 50 tags with a feature.</p>
234    /// <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>
235    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
236        self.inner.get_tags()
237    }
238    ///
239    /// Adds a key-value pair to `entityOverrides`.
240    ///
241    /// To override the contents of this collection use [`set_entity_overrides`](Self::set_entity_overrides).
242    ///
243    /// <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>
244    /// <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>
245    pub fn entity_overrides(
246        mut self,
247        k: impl ::std::convert::Into<::std::string::String>,
248        v: impl ::std::convert::Into<::std::string::String>,
249    ) -> Self {
250        self.inner = self.inner.entity_overrides(k.into(), v.into());
251        self
252    }
253    /// <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>
254    /// <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>
255    pub fn set_entity_overrides(
256        mut self,
257        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
258    ) -> Self {
259        self.inner = self.inner.set_entity_overrides(input);
260        self
261    }
262    /// <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>
263    /// <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>
264    pub fn get_entity_overrides(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
265        self.inner.get_entity_overrides()
266    }
267}