aws_sdk_evidently/operation/create_experiment/
_create_experiment_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 CreateExperimentInput {
6    /// <p>The name or ARN of the project that you want to create the new experiment in.</p>
7    pub project: ::std::option::Option<::std::string::String>,
8    /// <p>A name for the new experiment.</p>
9    pub name: ::std::option::Option<::std::string::String>,
10    /// <p>An optional description of the experiment.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>An array of structures that describe the configuration of each feature variation used in the experiment.</p>
13    pub treatments: ::std::option::Option<::std::vec::Vec<crate::types::TreatmentConfig>>,
14    /// <p>An array of structures that defines the metrics used for the experiment, and whether a higher or lower value for each metric is the goal.</p>
15    pub metric_goals: ::std::option::Option<::std::vec::Vec<crate::types::MetricGoalConfig>>,
16    /// <p>When Evidently assigns a particular user session to an experiment, it must use a randomization ID to determine which variation the user session is served. This randomization ID is a combination of the entity ID and <code>randomizationSalt</code>. If you omit <code>randomizationSalt</code>, Evidently uses the experiment name as the <code>randomizationSalt</code>.</p>
17    pub randomization_salt: ::std::option::Option<::std::string::String>,
18    /// <p>The portion of the available audience that you want to allocate to this experiment, in thousandths of a percent. The available audience is the total audience minus the audience that you have allocated to overrides or current launches of this feature.</p>
19    /// <p>This is represented in thousandths of a percent. For example, specify 10,000 to allocate 10% of the available audience.</p>
20    pub sampling_rate: ::std::option::Option<i64>,
21    /// <p>A structure that contains the configuration of which variation to use as the "control" version. tThe "control" version is used for comparison with other variations. This structure also specifies how much experiment traffic is allocated to each variation.</p>
22    pub online_ab_config: ::std::option::Option<crate::types::OnlineAbConfig>,
23    /// <p>Specifies an audience <i>segment</i> to use in the experiment. When a segment is used in an experiment, only user sessions that match the segment pattern are used in the experiment.</p>
24    pub segment: ::std::option::Option<::std::string::String>,
25    /// <p>Assigns one or more tags (key-value pairs) to the experiment.</p>
26    /// <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>
27    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
28    /// <p>You can associate as many as 50 tags with an experiment.</p>
29    /// <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>
30    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
31}
32impl CreateExperimentInput {
33    /// <p>The name or ARN of the project that you want to create the new experiment in.</p>
34    pub fn project(&self) -> ::std::option::Option<&str> {
35        self.project.as_deref()
36    }
37    /// <p>A name for the new experiment.</p>
38    pub fn name(&self) -> ::std::option::Option<&str> {
39        self.name.as_deref()
40    }
41    /// <p>An optional description of the experiment.</p>
42    pub fn description(&self) -> ::std::option::Option<&str> {
43        self.description.as_deref()
44    }
45    /// <p>An array of structures that describe the configuration of each feature variation used in the experiment.</p>
46    ///
47    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.treatments.is_none()`.
48    pub fn treatments(&self) -> &[crate::types::TreatmentConfig] {
49        self.treatments.as_deref().unwrap_or_default()
50    }
51    /// <p>An array of structures that defines the metrics used for the experiment, and whether a higher or lower value for each metric is the goal.</p>
52    ///
53    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.metric_goals.is_none()`.
54    pub fn metric_goals(&self) -> &[crate::types::MetricGoalConfig] {
55        self.metric_goals.as_deref().unwrap_or_default()
56    }
57    /// <p>When Evidently assigns a particular user session to an experiment, it must use a randomization ID to determine which variation the user session is served. This randomization ID is a combination of the entity ID and <code>randomizationSalt</code>. If you omit <code>randomizationSalt</code>, Evidently uses the experiment name as the <code>randomizationSalt</code>.</p>
58    pub fn randomization_salt(&self) -> ::std::option::Option<&str> {
59        self.randomization_salt.as_deref()
60    }
61    /// <p>The portion of the available audience that you want to allocate to this experiment, in thousandths of a percent. The available audience is the total audience minus the audience that you have allocated to overrides or current launches of this feature.</p>
62    /// <p>This is represented in thousandths of a percent. For example, specify 10,000 to allocate 10% of the available audience.</p>
63    pub fn sampling_rate(&self) -> ::std::option::Option<i64> {
64        self.sampling_rate
65    }
66    /// <p>A structure that contains the configuration of which variation to use as the "control" version. tThe "control" version is used for comparison with other variations. This structure also specifies how much experiment traffic is allocated to each variation.</p>
67    pub fn online_ab_config(&self) -> ::std::option::Option<&crate::types::OnlineAbConfig> {
68        self.online_ab_config.as_ref()
69    }
70    /// <p>Specifies an audience <i>segment</i> to use in the experiment. When a segment is used in an experiment, only user sessions that match the segment pattern are used in the experiment.</p>
71    pub fn segment(&self) -> ::std::option::Option<&str> {
72        self.segment.as_deref()
73    }
74    /// <p>Assigns one or more tags (key-value pairs) to the experiment.</p>
75    /// <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>
76    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
77    /// <p>You can associate as many as 50 tags with an experiment.</p>
78    /// <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>
79    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
80        self.tags.as_ref()
81    }
82}
83impl CreateExperimentInput {
84    /// Creates a new builder-style object to manufacture [`CreateExperimentInput`](crate::operation::create_experiment::CreateExperimentInput).
85    pub fn builder() -> crate::operation::create_experiment::builders::CreateExperimentInputBuilder {
86        crate::operation::create_experiment::builders::CreateExperimentInputBuilder::default()
87    }
88}
89
90/// A builder for [`CreateExperimentInput`](crate::operation::create_experiment::CreateExperimentInput).
91#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
92#[non_exhaustive]
93pub struct CreateExperimentInputBuilder {
94    pub(crate) project: ::std::option::Option<::std::string::String>,
95    pub(crate) name: ::std::option::Option<::std::string::String>,
96    pub(crate) description: ::std::option::Option<::std::string::String>,
97    pub(crate) treatments: ::std::option::Option<::std::vec::Vec<crate::types::TreatmentConfig>>,
98    pub(crate) metric_goals: ::std::option::Option<::std::vec::Vec<crate::types::MetricGoalConfig>>,
99    pub(crate) randomization_salt: ::std::option::Option<::std::string::String>,
100    pub(crate) sampling_rate: ::std::option::Option<i64>,
101    pub(crate) online_ab_config: ::std::option::Option<crate::types::OnlineAbConfig>,
102    pub(crate) segment: ::std::option::Option<::std::string::String>,
103    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
104}
105impl CreateExperimentInputBuilder {
106    /// <p>The name or ARN of the project that you want to create the new experiment in.</p>
107    /// This field is required.
108    pub fn project(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
109        self.project = ::std::option::Option::Some(input.into());
110        self
111    }
112    /// <p>The name or ARN of the project that you want to create the new experiment in.</p>
113    pub fn set_project(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
114        self.project = input;
115        self
116    }
117    /// <p>The name or ARN of the project that you want to create the new experiment in.</p>
118    pub fn get_project(&self) -> &::std::option::Option<::std::string::String> {
119        &self.project
120    }
121    /// <p>A name for the new experiment.</p>
122    /// This field is required.
123    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.name = ::std::option::Option::Some(input.into());
125        self
126    }
127    /// <p>A name for the new experiment.</p>
128    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129        self.name = input;
130        self
131    }
132    /// <p>A name for the new experiment.</p>
133    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
134        &self.name
135    }
136    /// <p>An optional description of the experiment.</p>
137    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.description = ::std::option::Option::Some(input.into());
139        self
140    }
141    /// <p>An optional description of the experiment.</p>
142    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.description = input;
144        self
145    }
146    /// <p>An optional description of the experiment.</p>
147    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
148        &self.description
149    }
150    /// Appends an item to `treatments`.
151    ///
152    /// To override the contents of this collection use [`set_treatments`](Self::set_treatments).
153    ///
154    /// <p>An array of structures that describe the configuration of each feature variation used in the experiment.</p>
155    pub fn treatments(mut self, input: crate::types::TreatmentConfig) -> Self {
156        let mut v = self.treatments.unwrap_or_default();
157        v.push(input);
158        self.treatments = ::std::option::Option::Some(v);
159        self
160    }
161    /// <p>An array of structures that describe the configuration of each feature variation used in the experiment.</p>
162    pub fn set_treatments(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TreatmentConfig>>) -> Self {
163        self.treatments = input;
164        self
165    }
166    /// <p>An array of structures that describe the configuration of each feature variation used in the experiment.</p>
167    pub fn get_treatments(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TreatmentConfig>> {
168        &self.treatments
169    }
170    /// Appends an item to `metric_goals`.
171    ///
172    /// To override the contents of this collection use [`set_metric_goals`](Self::set_metric_goals).
173    ///
174    /// <p>An array of structures that defines the metrics used for the experiment, and whether a higher or lower value for each metric is the goal.</p>
175    pub fn metric_goals(mut self, input: crate::types::MetricGoalConfig) -> Self {
176        let mut v = self.metric_goals.unwrap_or_default();
177        v.push(input);
178        self.metric_goals = ::std::option::Option::Some(v);
179        self
180    }
181    /// <p>An array of structures that defines the metrics used for the experiment, and whether a higher or lower value for each metric is the goal.</p>
182    pub fn set_metric_goals(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::MetricGoalConfig>>) -> Self {
183        self.metric_goals = input;
184        self
185    }
186    /// <p>An array of structures that defines the metrics used for the experiment, and whether a higher or lower value for each metric is the goal.</p>
187    pub fn get_metric_goals(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::MetricGoalConfig>> {
188        &self.metric_goals
189    }
190    /// <p>When Evidently assigns a particular user session to an experiment, it must use a randomization ID to determine which variation the user session is served. This randomization ID is a combination of the entity ID and <code>randomizationSalt</code>. If you omit <code>randomizationSalt</code>, Evidently uses the experiment name as the <code>randomizationSalt</code>.</p>
191    pub fn randomization_salt(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
192        self.randomization_salt = ::std::option::Option::Some(input.into());
193        self
194    }
195    /// <p>When Evidently assigns a particular user session to an experiment, it must use a randomization ID to determine which variation the user session is served. This randomization ID is a combination of the entity ID and <code>randomizationSalt</code>. If you omit <code>randomizationSalt</code>, Evidently uses the experiment name as the <code>randomizationSalt</code>.</p>
196    pub fn set_randomization_salt(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
197        self.randomization_salt = input;
198        self
199    }
200    /// <p>When Evidently assigns a particular user session to an experiment, it must use a randomization ID to determine which variation the user session is served. This randomization ID is a combination of the entity ID and <code>randomizationSalt</code>. If you omit <code>randomizationSalt</code>, Evidently uses the experiment name as the <code>randomizationSalt</code>.</p>
201    pub fn get_randomization_salt(&self) -> &::std::option::Option<::std::string::String> {
202        &self.randomization_salt
203    }
204    /// <p>The portion of the available audience that you want to allocate to this experiment, in thousandths of a percent. The available audience is the total audience minus the audience that you have allocated to overrides or current launches of this feature.</p>
205    /// <p>This is represented in thousandths of a percent. For example, specify 10,000 to allocate 10% of the available audience.</p>
206    pub fn sampling_rate(mut self, input: i64) -> Self {
207        self.sampling_rate = ::std::option::Option::Some(input);
208        self
209    }
210    /// <p>The portion of the available audience that you want to allocate to this experiment, in thousandths of a percent. The available audience is the total audience minus the audience that you have allocated to overrides or current launches of this feature.</p>
211    /// <p>This is represented in thousandths of a percent. For example, specify 10,000 to allocate 10% of the available audience.</p>
212    pub fn set_sampling_rate(mut self, input: ::std::option::Option<i64>) -> Self {
213        self.sampling_rate = input;
214        self
215    }
216    /// <p>The portion of the available audience that you want to allocate to this experiment, in thousandths of a percent. The available audience is the total audience minus the audience that you have allocated to overrides or current launches of this feature.</p>
217    /// <p>This is represented in thousandths of a percent. For example, specify 10,000 to allocate 10% of the available audience.</p>
218    pub fn get_sampling_rate(&self) -> &::std::option::Option<i64> {
219        &self.sampling_rate
220    }
221    /// <p>A structure that contains the configuration of which variation to use as the "control" version. tThe "control" version is used for comparison with other variations. This structure also specifies how much experiment traffic is allocated to each variation.</p>
222    pub fn online_ab_config(mut self, input: crate::types::OnlineAbConfig) -> Self {
223        self.online_ab_config = ::std::option::Option::Some(input);
224        self
225    }
226    /// <p>A structure that contains the configuration of which variation to use as the "control" version. tThe "control" version is used for comparison with other variations. This structure also specifies how much experiment traffic is allocated to each variation.</p>
227    pub fn set_online_ab_config(mut self, input: ::std::option::Option<crate::types::OnlineAbConfig>) -> Self {
228        self.online_ab_config = input;
229        self
230    }
231    /// <p>A structure that contains the configuration of which variation to use as the "control" version. tThe "control" version is used for comparison with other variations. This structure also specifies how much experiment traffic is allocated to each variation.</p>
232    pub fn get_online_ab_config(&self) -> &::std::option::Option<crate::types::OnlineAbConfig> {
233        &self.online_ab_config
234    }
235    /// <p>Specifies an audience <i>segment</i> to use in the experiment. When a segment is used in an experiment, only user sessions that match the segment pattern are used in the experiment.</p>
236    pub fn segment(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
237        self.segment = ::std::option::Option::Some(input.into());
238        self
239    }
240    /// <p>Specifies an audience <i>segment</i> to use in the experiment. When a segment is used in an experiment, only user sessions that match the segment pattern are used in the experiment.</p>
241    pub fn set_segment(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
242        self.segment = input;
243        self
244    }
245    /// <p>Specifies an audience <i>segment</i> to use in the experiment. When a segment is used in an experiment, only user sessions that match the segment pattern are used in the experiment.</p>
246    pub fn get_segment(&self) -> &::std::option::Option<::std::string::String> {
247        &self.segment
248    }
249    /// Adds a key-value pair to `tags`.
250    ///
251    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
252    ///
253    /// <p>Assigns one or more tags (key-value pairs) to the experiment.</p>
254    /// <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>
255    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
256    /// <p>You can associate as many as 50 tags with an experiment.</p>
257    /// <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>
258    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
259        let mut hash_map = self.tags.unwrap_or_default();
260        hash_map.insert(k.into(), v.into());
261        self.tags = ::std::option::Option::Some(hash_map);
262        self
263    }
264    /// <p>Assigns one or more tags (key-value pairs) to the experiment.</p>
265    /// <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>
266    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
267    /// <p>You can associate as many as 50 tags with an experiment.</p>
268    /// <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>
269    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
270        self.tags = input;
271        self
272    }
273    /// <p>Assigns one or more tags (key-value pairs) to the experiment.</p>
274    /// <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>
275    /// <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
276    /// <p>You can associate as many as 50 tags with an experiment.</p>
277    /// <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>
278    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
279        &self.tags
280    }
281    /// Consumes the builder and constructs a [`CreateExperimentInput`](crate::operation::create_experiment::CreateExperimentInput).
282    pub fn build(
283        self,
284    ) -> ::std::result::Result<crate::operation::create_experiment::CreateExperimentInput, ::aws_smithy_types::error::operation::BuildError> {
285        ::std::result::Result::Ok(crate::operation::create_experiment::CreateExperimentInput {
286            project: self.project,
287            name: self.name,
288            description: self.description,
289            treatments: self.treatments,
290            metric_goals: self.metric_goals,
291            randomization_salt: self.randomization_salt,
292            sampling_rate: self.sampling_rate,
293            online_ab_config: self.online_ab_config,
294            segment: self.segment,
295            tags: self.tags,
296        })
297    }
298}