aws-sdk-quicksight 1.129.0

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

/// <p>Defines an aggregation function to be applied to grouped data, creating a new column with the calculated result.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Aggregation {
    /// <p>The aggregation function to apply, such as <code>SUM</code>, <code>COUNT</code>, <code>AVERAGE</code>, <code>MIN</code>, <code>MAX</code></p>
    pub aggregation_function: ::std::option::Option<crate::types::DataPrepAggregationFunction>,
    /// <p>The name for the new column that will contain the aggregated values.</p>
    pub new_column_name: ::std::string::String,
    /// <p>A unique identifier for the new column that will contain the aggregated values.</p>
    pub new_column_id: ::std::string::String,
}
impl Aggregation {
    /// <p>The aggregation function to apply, such as <code>SUM</code>, <code>COUNT</code>, <code>AVERAGE</code>, <code>MIN</code>, <code>MAX</code></p>
    pub fn aggregation_function(&self) -> ::std::option::Option<&crate::types::DataPrepAggregationFunction> {
        self.aggregation_function.as_ref()
    }
    /// <p>The name for the new column that will contain the aggregated values.</p>
    pub fn new_column_name(&self) -> &str {
        use std::ops::Deref;
        self.new_column_name.deref()
    }
    /// <p>A unique identifier for the new column that will contain the aggregated values.</p>
    pub fn new_column_id(&self) -> &str {
        use std::ops::Deref;
        self.new_column_id.deref()
    }
}
impl Aggregation {
    /// Creates a new builder-style object to manufacture [`Aggregation`](crate::types::Aggregation).
    pub fn builder() -> crate::types::builders::AggregationBuilder {
        crate::types::builders::AggregationBuilder::default()
    }
}

/// A builder for [`Aggregation`](crate::types::Aggregation).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AggregationBuilder {
    pub(crate) aggregation_function: ::std::option::Option<crate::types::DataPrepAggregationFunction>,
    pub(crate) new_column_name: ::std::option::Option<::std::string::String>,
    pub(crate) new_column_id: ::std::option::Option<::std::string::String>,
}
impl AggregationBuilder {
    /// <p>The aggregation function to apply, such as <code>SUM</code>, <code>COUNT</code>, <code>AVERAGE</code>, <code>MIN</code>, <code>MAX</code></p>
    /// This field is required.
    pub fn aggregation_function(mut self, input: crate::types::DataPrepAggregationFunction) -> Self {
        self.aggregation_function = ::std::option::Option::Some(input);
        self
    }
    /// <p>The aggregation function to apply, such as <code>SUM</code>, <code>COUNT</code>, <code>AVERAGE</code>, <code>MIN</code>, <code>MAX</code></p>
    pub fn set_aggregation_function(mut self, input: ::std::option::Option<crate::types::DataPrepAggregationFunction>) -> Self {
        self.aggregation_function = input;
        self
    }
    /// <p>The aggregation function to apply, such as <code>SUM</code>, <code>COUNT</code>, <code>AVERAGE</code>, <code>MIN</code>, <code>MAX</code></p>
    pub fn get_aggregation_function(&self) -> &::std::option::Option<crate::types::DataPrepAggregationFunction> {
        &self.aggregation_function
    }
    /// <p>The name for the new column that will contain the aggregated values.</p>
    /// This field is required.
    pub fn new_column_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.new_column_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name for the new column that will contain the aggregated values.</p>
    pub fn set_new_column_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.new_column_name = input;
        self
    }
    /// <p>The name for the new column that will contain the aggregated values.</p>
    pub fn get_new_column_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.new_column_name
    }
    /// <p>A unique identifier for the new column that will contain the aggregated values.</p>
    /// This field is required.
    pub fn new_column_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.new_column_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A unique identifier for the new column that will contain the aggregated values.</p>
    pub fn set_new_column_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.new_column_id = input;
        self
    }
    /// <p>A unique identifier for the new column that will contain the aggregated values.</p>
    pub fn get_new_column_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.new_column_id
    }
    /// Consumes the builder and constructs a [`Aggregation`](crate::types::Aggregation).
    /// This method will fail if any of the following fields are not set:
    /// - [`new_column_name`](crate::types::builders::AggregationBuilder::new_column_name)
    /// - [`new_column_id`](crate::types::builders::AggregationBuilder::new_column_id)
    pub fn build(self) -> ::std::result::Result<crate::types::Aggregation, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Aggregation {
            aggregation_function: self.aggregation_function,
            new_column_name: self.new_column_name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "new_column_name",
                    "new_column_name was not specified but it is required when building Aggregation",
                )
            })?,
            new_column_id: self.new_column_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "new_column_id",
                    "new_column_id was not specified but it is required when building Aggregation",
                )
            })?,
        })
    }
}