1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>This structure specifies a segment that you have already created, and defines the traffic split for that segment to be used in a launch.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct SegmentOverride {
/// <p>The ARN of the segment to use.</p>
pub segment: ::std::string::String,
/// <p>A number indicating the order to use to evaluate segment overrides, if there are more than one. Segment overrides with lower numbers are evaluated first.</p>
pub evaluation_order: i64,
/// <p>The traffic allocation percentages among the feature variations to assign to this segment. This is a set of key-value pairs. The keys are variation names. The values represent the amount of traffic to allocate to that variation for this segment. This is expressed in thousandths of a percent, so a weight of 50000 represents 50% of traffic.</p>
pub weights: ::std::collections::HashMap<::std::string::String, i64>,
}
impl SegmentOverride {
/// <p>The ARN of the segment to use.</p>
pub fn segment(&self) -> &str {
use std::ops::Deref;
self.segment.deref()
}
/// <p>A number indicating the order to use to evaluate segment overrides, if there are more than one. Segment overrides with lower numbers are evaluated first.</p>
pub fn evaluation_order(&self) -> i64 {
self.evaluation_order
}
/// <p>The traffic allocation percentages among the feature variations to assign to this segment. This is a set of key-value pairs. The keys are variation names. The values represent the amount of traffic to allocate to that variation for this segment. This is expressed in thousandths of a percent, so a weight of 50000 represents 50% of traffic.</p>
pub fn weights(&self) -> &::std::collections::HashMap<::std::string::String, i64> {
&self.weights
}
}
impl SegmentOverride {
/// Creates a new builder-style object to manufacture [`SegmentOverride`](crate::types::SegmentOverride).
pub fn builder() -> crate::types::builders::SegmentOverrideBuilder {
crate::types::builders::SegmentOverrideBuilder::default()
}
}
/// A builder for [`SegmentOverride`](crate::types::SegmentOverride).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct SegmentOverrideBuilder {
pub(crate) segment: ::std::option::Option<::std::string::String>,
pub(crate) evaluation_order: ::std::option::Option<i64>,
pub(crate) weights: ::std::option::Option<::std::collections::HashMap<::std::string::String, i64>>,
}
impl SegmentOverrideBuilder {
/// <p>The ARN of the segment to use.</p>
/// This field is required.
pub fn segment(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.segment = ::std::option::Option::Some(input.into());
self
}
/// <p>The ARN of the segment to use.</p>
pub fn set_segment(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.segment = input;
self
}
/// <p>The ARN of the segment to use.</p>
pub fn get_segment(&self) -> &::std::option::Option<::std::string::String> {
&self.segment
}
/// <p>A number indicating the order to use to evaluate segment overrides, if there are more than one. Segment overrides with lower numbers are evaluated first.</p>
/// This field is required.
pub fn evaluation_order(mut self, input: i64) -> Self {
self.evaluation_order = ::std::option::Option::Some(input);
self
}
/// <p>A number indicating the order to use to evaluate segment overrides, if there are more than one. Segment overrides with lower numbers are evaluated first.</p>
pub fn set_evaluation_order(mut self, input: ::std::option::Option<i64>) -> Self {
self.evaluation_order = input;
self
}
/// <p>A number indicating the order to use to evaluate segment overrides, if there are more than one. Segment overrides with lower numbers are evaluated first.</p>
pub fn get_evaluation_order(&self) -> &::std::option::Option<i64> {
&self.evaluation_order
}
/// Adds a key-value pair to `weights`.
///
/// To override the contents of this collection use [`set_weights`](Self::set_weights).
///
/// <p>The traffic allocation percentages among the feature variations to assign to this segment. This is a set of key-value pairs. The keys are variation names. The values represent the amount of traffic to allocate to that variation for this segment. This is expressed in thousandths of a percent, so a weight of 50000 represents 50% of traffic.</p>
pub fn weights(mut self, k: impl ::std::convert::Into<::std::string::String>, v: i64) -> Self {
let mut hash_map = self.weights.unwrap_or_default();
hash_map.insert(k.into(), v);
self.weights = ::std::option::Option::Some(hash_map);
self
}
/// <p>The traffic allocation percentages among the feature variations to assign to this segment. This is a set of key-value pairs. The keys are variation names. The values represent the amount of traffic to allocate to that variation for this segment. This is expressed in thousandths of a percent, so a weight of 50000 represents 50% of traffic.</p>
pub fn set_weights(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, i64>>) -> Self {
self.weights = input;
self
}
/// <p>The traffic allocation percentages among the feature variations to assign to this segment. This is a set of key-value pairs. The keys are variation names. The values represent the amount of traffic to allocate to that variation for this segment. This is expressed in thousandths of a percent, so a weight of 50000 represents 50% of traffic.</p>
pub fn get_weights(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, i64>> {
&self.weights
}
/// Consumes the builder and constructs a [`SegmentOverride`](crate::types::SegmentOverride).
/// This method will fail if any of the following fields are not set:
/// - [`segment`](crate::types::builders::SegmentOverrideBuilder::segment)
/// - [`evaluation_order`](crate::types::builders::SegmentOverrideBuilder::evaluation_order)
/// - [`weights`](crate::types::builders::SegmentOverrideBuilder::weights)
pub fn build(self) -> ::std::result::Result<crate::types::SegmentOverride, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::SegmentOverride {
segment: self.segment.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"segment",
"segment was not specified but it is required when building SegmentOverride",
)
})?,
evaluation_order: self.evaluation_order.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"evaluation_order",
"evaluation_order was not specified but it is required when building SegmentOverride",
)
})?,
weights: self.weights.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"weights",
"weights was not specified but it is required when building SegmentOverride",
)
})?,
})
}
}