aws-sdk-personalizeruntime 1.4.0

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

/// <p>Contains information on a promotion. A promotion defines additional business rules that apply to a configurable subset of recommended items.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Promotion {
    /// <p>The name of the promotion.</p>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>The percentage of recommended items to apply the promotion to.</p>
    pub percent_promoted_items: ::std::option::Option<i32>,
    /// <p>The Amazon Resource Name (ARN) of the filter used by the promotion. This filter defines the criteria for promoted items. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/promoting-items.html#promotion-filters">Promotion filters</a>.</p>
    pub filter_arn: ::std::option::Option<::std::string::String>,
    /// <p>The values to use when promoting items. For each placeholder parameter in your promotion's filter expression, provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. Separate multiple values for one parameter with a comma. </p>
    /// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>. In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
    /// <p>For more information on creating filters, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering recommendations and user segments</a>.</p>
    pub filter_values: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl Promotion {
    /// <p>The name of the promotion.</p>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>The percentage of recommended items to apply the promotion to.</p>
    pub fn percent_promoted_items(&self) -> ::std::option::Option<i32> {
        self.percent_promoted_items
    }
    /// <p>The Amazon Resource Name (ARN) of the filter used by the promotion. This filter defines the criteria for promoted items. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/promoting-items.html#promotion-filters">Promotion filters</a>.</p>
    pub fn filter_arn(&self) -> ::std::option::Option<&str> {
        self.filter_arn.as_deref()
    }
    /// <p>The values to use when promoting items. For each placeholder parameter in your promotion's filter expression, provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. Separate multiple values for one parameter with a comma. </p>
    /// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>. In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
    /// <p>For more information on creating filters, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering recommendations and user segments</a>.</p>
    pub fn filter_values(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.filter_values.as_ref()
    }
}
impl Promotion {
    /// Creates a new builder-style object to manufacture [`Promotion`](crate::types::Promotion).
    pub fn builder() -> crate::types::builders::PromotionBuilder {
        crate::types::builders::PromotionBuilder::default()
    }
}

/// A builder for [`Promotion`](crate::types::Promotion).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct PromotionBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) percent_promoted_items: ::std::option::Option<i32>,
    pub(crate) filter_arn: ::std::option::Option<::std::string::String>,
    pub(crate) filter_values: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl PromotionBuilder {
    /// <p>The name of the promotion.</p>
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the promotion.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The name of the promotion.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>The percentage of recommended items to apply the promotion to.</p>
    pub fn percent_promoted_items(mut self, input: i32) -> Self {
        self.percent_promoted_items = ::std::option::Option::Some(input);
        self
    }
    /// <p>The percentage of recommended items to apply the promotion to.</p>
    pub fn set_percent_promoted_items(mut self, input: ::std::option::Option<i32>) -> Self {
        self.percent_promoted_items = input;
        self
    }
    /// <p>The percentage of recommended items to apply the promotion to.</p>
    pub fn get_percent_promoted_items(&self) -> &::std::option::Option<i32> {
        &self.percent_promoted_items
    }
    /// <p>The Amazon Resource Name (ARN) of the filter used by the promotion. This filter defines the criteria for promoted items. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/promoting-items.html#promotion-filters">Promotion filters</a>.</p>
    pub fn filter_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.filter_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the filter used by the promotion. This filter defines the criteria for promoted items. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/promoting-items.html#promotion-filters">Promotion filters</a>.</p>
    pub fn set_filter_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.filter_arn = input;
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the filter used by the promotion. This filter defines the criteria for promoted items. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/promoting-items.html#promotion-filters">Promotion filters</a>.</p>
    pub fn get_filter_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.filter_arn
    }
    /// Adds a key-value pair to `filter_values`.
    ///
    /// To override the contents of this collection use [`set_filter_values`](Self::set_filter_values).
    ///
    /// <p>The values to use when promoting items. For each placeholder parameter in your promotion's filter expression, provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. Separate multiple values for one parameter with a comma. </p>
    /// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>. In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
    /// <p>For more information on creating filters, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering recommendations and user segments</a>.</p>
    pub fn filter_values(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.filter_values.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.filter_values = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>The values to use when promoting items. For each placeholder parameter in your promotion's filter expression, provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. Separate multiple values for one parameter with a comma. </p>
    /// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>. In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
    /// <p>For more information on creating filters, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering recommendations and user segments</a>.</p>
    pub fn set_filter_values(
        mut self,
        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    ) -> Self {
        self.filter_values = input;
        self
    }
    /// <p>The values to use when promoting items. For each placeholder parameter in your promotion's filter expression, provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. Separate multiple values for one parameter with a comma. </p>
    /// <p>For filter expressions that use an <code>INCLUDE</code> element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an <code>EXCLUDE</code> element to exclude items, you can omit the <code>filter-values</code>. In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.</p>
    /// <p>For more information on creating filters, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/filter.html">Filtering recommendations and user segments</a>.</p>
    pub fn get_filter_values(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.filter_values
    }
    /// Consumes the builder and constructs a [`Promotion`](crate::types::Promotion).
    pub fn build(self) -> crate::types::Promotion {
        crate::types::Promotion {
            name: self.name,
            percent_promoted_items: self.percent_promoted_items,
            filter_arn: self.filter_arn,
            filter_values: self.filter_values,
        }
    }
}