aws_sdk_evidently/types/_online_ab_config.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A structure that contains the configuration of which variation to use as the "control" version. The "control" version is used for comparison with other variations. This structure also specifies how much experiment traffic is allocated to each variation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct OnlineAbConfig {
7 /// <p>The name of the variation that is to be the default variation that the other variations are compared to.</p>
8 pub control_treatment_name: ::std::option::Option<::std::string::String>,
9 /// <p>A set of key-value pairs. The keys are variation names, and the values are the portion of experiment traffic to be assigned to that variation. Specify the traffic portion in thousandths of a percent, so 20,000 for a variation would allocate 20% of the experiment traffic to that variation.</p>
10 pub treatment_weights: ::std::option::Option<::std::collections::HashMap<::std::string::String, i64>>,
11}
12impl OnlineAbConfig {
13 /// <p>The name of the variation that is to be the default variation that the other variations are compared to.</p>
14 pub fn control_treatment_name(&self) -> ::std::option::Option<&str> {
15 self.control_treatment_name.as_deref()
16 }
17 /// <p>A set of key-value pairs. The keys are variation names, and the values are the portion of experiment traffic to be assigned to that variation. Specify the traffic portion in thousandths of a percent, so 20,000 for a variation would allocate 20% of the experiment traffic to that variation.</p>
18 pub fn treatment_weights(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, i64>> {
19 self.treatment_weights.as_ref()
20 }
21}
22impl OnlineAbConfig {
23 /// Creates a new builder-style object to manufacture [`OnlineAbConfig`](crate::types::OnlineAbConfig).
24 pub fn builder() -> crate::types::builders::OnlineAbConfigBuilder {
25 crate::types::builders::OnlineAbConfigBuilder::default()
26 }
27}
28
29/// A builder for [`OnlineAbConfig`](crate::types::OnlineAbConfig).
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31#[non_exhaustive]
32pub struct OnlineAbConfigBuilder {
33 pub(crate) control_treatment_name: ::std::option::Option<::std::string::String>,
34 pub(crate) treatment_weights: ::std::option::Option<::std::collections::HashMap<::std::string::String, i64>>,
35}
36impl OnlineAbConfigBuilder {
37 /// <p>The name of the variation that is to be the default variation that the other variations are compared to.</p>
38 pub fn control_treatment_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
39 self.control_treatment_name = ::std::option::Option::Some(input.into());
40 self
41 }
42 /// <p>The name of the variation that is to be the default variation that the other variations are compared to.</p>
43 pub fn set_control_treatment_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
44 self.control_treatment_name = input;
45 self
46 }
47 /// <p>The name of the variation that is to be the default variation that the other variations are compared to.</p>
48 pub fn get_control_treatment_name(&self) -> &::std::option::Option<::std::string::String> {
49 &self.control_treatment_name
50 }
51 /// Adds a key-value pair to `treatment_weights`.
52 ///
53 /// To override the contents of this collection use [`set_treatment_weights`](Self::set_treatment_weights).
54 ///
55 /// <p>A set of key-value pairs. The keys are variation names, and the values are the portion of experiment traffic to be assigned to that variation. Specify the traffic portion in thousandths of a percent, so 20,000 for a variation would allocate 20% of the experiment traffic to that variation.</p>
56 pub fn treatment_weights(mut self, k: impl ::std::convert::Into<::std::string::String>, v: i64) -> Self {
57 let mut hash_map = self.treatment_weights.unwrap_or_default();
58 hash_map.insert(k.into(), v);
59 self.treatment_weights = ::std::option::Option::Some(hash_map);
60 self
61 }
62 /// <p>A set of key-value pairs. The keys are variation names, and the values are the portion of experiment traffic to be assigned to that variation. Specify the traffic portion in thousandths of a percent, so 20,000 for a variation would allocate 20% of the experiment traffic to that variation.</p>
63 pub fn set_treatment_weights(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, i64>>) -> Self {
64 self.treatment_weights = input;
65 self
66 }
67 /// <p>A set of key-value pairs. The keys are variation names, and the values are the portion of experiment traffic to be assigned to that variation. Specify the traffic portion in thousandths of a percent, so 20,000 for a variation would allocate 20% of the experiment traffic to that variation.</p>
68 pub fn get_treatment_weights(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, i64>> {
69 &self.treatment_weights
70 }
71 /// Consumes the builder and constructs a [`OnlineAbConfig`](crate::types::OnlineAbConfig).
72 pub fn build(self) -> crate::types::OnlineAbConfig {
73 crate::types::OnlineAbConfig {
74 control_treatment_name: self.control_treatment_name,
75 treatment_weights: self.treatment_weights,
76 }
77 }
78}