Skip to main content

aws_sdk_iotanalytics/types/
_partition.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A partition dimension defined by an attribute.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Partition {
7    /// <p>The name of the attribute that defines a partition dimension.</p>
8    pub attribute_name: ::std::string::String,
9}
10impl Partition {
11    /// <p>The name of the attribute that defines a partition dimension.</p>
12    pub fn attribute_name(&self) -> &str {
13        use std::ops::Deref;
14        self.attribute_name.deref()
15    }
16}
17impl Partition {
18    /// Creates a new builder-style object to manufacture [`Partition`](crate::types::Partition).
19    pub fn builder() -> crate::types::builders::PartitionBuilder {
20        crate::types::builders::PartitionBuilder::default()
21    }
22}
23
24/// A builder for [`Partition`](crate::types::Partition).
25#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
26#[non_exhaustive]
27pub struct PartitionBuilder {
28    pub(crate) attribute_name: ::std::option::Option<::std::string::String>,
29}
30impl PartitionBuilder {
31    /// <p>The name of the attribute that defines a partition dimension.</p>
32    /// This field is required.
33    pub fn attribute_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
34        self.attribute_name = ::std::option::Option::Some(input.into());
35        self
36    }
37    /// <p>The name of the attribute that defines a partition dimension.</p>
38    pub fn set_attribute_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
39        self.attribute_name = input;
40        self
41    }
42    /// <p>The name of the attribute that defines a partition dimension.</p>
43    pub fn get_attribute_name(&self) -> &::std::option::Option<::std::string::String> {
44        &self.attribute_name
45    }
46    /// Consumes the builder and constructs a [`Partition`](crate::types::Partition).
47    /// This method will fail if any of the following fields are not set:
48    /// - [`attribute_name`](crate::types::builders::PartitionBuilder::attribute_name)
49    pub fn build(self) -> ::std::result::Result<crate::types::Partition, ::aws_smithy_types::error::operation::BuildError> {
50        ::std::result::Result::Ok(crate::types::Partition {
51            attribute_name: self.attribute_name.ok_or_else(|| {
52                ::aws_smithy_types::error::operation::BuildError::missing_field(
53                    "attribute_name",
54                    "attribute_name was not specified but it is required when building Partition",
55                )
56            })?,
57        })
58    }
59}