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
// 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",
)
})?,
})
}
}