aws-sdk-appconfig 1.108.0

AWS SDK for Amazon AppConfig
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Describes a treatment in an experiment, including its traffic allocation weight and feature flag value.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Treatment {
    /// <p>The unique key that identifies this treatment.</p>
    pub key: ::std::option::Option<::std::string::String>,
    /// <p>The traffic allocation weight for this treatment.</p>
    pub weight: f32,
    /// <p>A description of the treatment.</p>
    pub description: ::std::option::Option<::std::string::String>,
    /// <p>The feature flag value served to users assigned to this treatment.</p>
    pub flag_value: ::std::option::Option<crate::types::FlagValue>,
}
impl Treatment {
    /// <p>The unique key that identifies this treatment.</p>
    pub fn key(&self) -> ::std::option::Option<&str> {
        self.key.as_deref()
    }
    /// <p>The traffic allocation weight for this treatment.</p>
    pub fn weight(&self) -> f32 {
        self.weight
    }
    /// <p>A description of the treatment.</p>
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
    /// <p>The feature flag value served to users assigned to this treatment.</p>
    pub fn flag_value(&self) -> ::std::option::Option<&crate::types::FlagValue> {
        self.flag_value.as_ref()
    }
}
impl Treatment {
    /// Creates a new builder-style object to manufacture [`Treatment`](crate::types::Treatment).
    pub fn builder() -> crate::types::builders::TreatmentBuilder {
        crate::types::builders::TreatmentBuilder::default()
    }
}

/// A builder for [`Treatment`](crate::types::Treatment).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct TreatmentBuilder {
    pub(crate) key: ::std::option::Option<::std::string::String>,
    pub(crate) weight: ::std::option::Option<f32>,
    pub(crate) description: ::std::option::Option<::std::string::String>,
    pub(crate) flag_value: ::std::option::Option<crate::types::FlagValue>,
}
impl TreatmentBuilder {
    /// <p>The unique key that identifies this treatment.</p>
    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.key = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique key that identifies this treatment.</p>
    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.key = input;
        self
    }
    /// <p>The unique key that identifies this treatment.</p>
    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
        &self.key
    }
    /// <p>The traffic allocation weight for this treatment.</p>
    /// This field is required.
    pub fn weight(mut self, input: f32) -> Self {
        self.weight = ::std::option::Option::Some(input);
        self
    }
    /// <p>The traffic allocation weight for this treatment.</p>
    pub fn set_weight(mut self, input: ::std::option::Option<f32>) -> Self {
        self.weight = input;
        self
    }
    /// <p>The traffic allocation weight for this treatment.</p>
    pub fn get_weight(&self) -> &::std::option::Option<f32> {
        &self.weight
    }
    /// <p>A description of the treatment.</p>
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A description of the treatment.</p>
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// <p>A description of the treatment.</p>
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// <p>The feature flag value served to users assigned to this treatment.</p>
    /// This field is required.
    pub fn flag_value(mut self, input: crate::types::FlagValue) -> Self {
        self.flag_value = ::std::option::Option::Some(input);
        self
    }
    /// <p>The feature flag value served to users assigned to this treatment.</p>
    pub fn set_flag_value(mut self, input: ::std::option::Option<crate::types::FlagValue>) -> Self {
        self.flag_value = input;
        self
    }
    /// <p>The feature flag value served to users assigned to this treatment.</p>
    pub fn get_flag_value(&self) -> &::std::option::Option<crate::types::FlagValue> {
        &self.flag_value
    }
    /// Consumes the builder and constructs a [`Treatment`](crate::types::Treatment).
    pub fn build(self) -> crate::types::Treatment {
        crate::types::Treatment {
            key: self.key,
            weight: self.weight.unwrap_or_default(),
            description: self.description,
            flag_value: self.flag_value,
        }
    }
}