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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Mathematical expression and a list of attribute items specified in that expression.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct AttributeDetails {
/// <p>A list of attribute items specified in the mathematical expression.</p>
pub attributes: ::std::vec::Vec<crate::types::AttributeItem>,
/// <p>Mathematical expression that is performed on attribute items provided in the attribute list. Each element in the expression should follow the structure of \"{ObjectTypeName.AttributeName}\".</p>
pub expression: ::std::string::String,
}
impl AttributeDetails {
/// <p>A list of attribute items specified in the mathematical expression.</p>
pub fn attributes(&self) -> &[crate::types::AttributeItem] {
use std::ops::Deref;
self.attributes.deref()
}
/// <p>Mathematical expression that is performed on attribute items provided in the attribute list. Each element in the expression should follow the structure of \"{ObjectTypeName.AttributeName}\".</p>
pub fn expression(&self) -> &str {
use std::ops::Deref;
self.expression.deref()
}
}
impl ::std::fmt::Debug for AttributeDetails {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("AttributeDetails");
formatter.field("attributes", &"*** Sensitive Data Redacted ***");
formatter.field("expression", &"*** Sensitive Data Redacted ***");
formatter.finish()
}
}
impl AttributeDetails {
/// Creates a new builder-style object to manufacture [`AttributeDetails`](crate::types::AttributeDetails).
pub fn builder() -> crate::types::builders::AttributeDetailsBuilder {
crate::types::builders::AttributeDetailsBuilder::default()
}
}
/// A builder for [`AttributeDetails`](crate::types::AttributeDetails).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
pub struct AttributeDetailsBuilder {
pub(crate) attributes: ::std::option::Option<::std::vec::Vec<crate::types::AttributeItem>>,
pub(crate) expression: ::std::option::Option<::std::string::String>,
}
impl AttributeDetailsBuilder {
/// Appends an item to `attributes`.
///
/// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
///
/// <p>A list of attribute items specified in the mathematical expression.</p>
pub fn attributes(mut self, input: crate::types::AttributeItem) -> Self {
let mut v = self.attributes.unwrap_or_default();
v.push(input);
self.attributes = ::std::option::Option::Some(v);
self
}
/// <p>A list of attribute items specified in the mathematical expression.</p>
pub fn set_attributes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AttributeItem>>) -> Self {
self.attributes = input;
self
}
/// <p>A list of attribute items specified in the mathematical expression.</p>
pub fn get_attributes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AttributeItem>> {
&self.attributes
}
/// <p>Mathematical expression that is performed on attribute items provided in the attribute list. Each element in the expression should follow the structure of \"{ObjectTypeName.AttributeName}\".</p>
/// This field is required.
pub fn expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.expression = ::std::option::Option::Some(input.into());
self
}
/// <p>Mathematical expression that is performed on attribute items provided in the attribute list. Each element in the expression should follow the structure of \"{ObjectTypeName.AttributeName}\".</p>
pub fn set_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.expression = input;
self
}
/// <p>Mathematical expression that is performed on attribute items provided in the attribute list. Each element in the expression should follow the structure of \"{ObjectTypeName.AttributeName}\".</p>
pub fn get_expression(&self) -> &::std::option::Option<::std::string::String> {
&self.expression
}
/// Consumes the builder and constructs a [`AttributeDetails`](crate::types::AttributeDetails).
/// This method will fail if any of the following fields are not set:
/// - [`attributes`](crate::types::builders::AttributeDetailsBuilder::attributes)
/// - [`expression`](crate::types::builders::AttributeDetailsBuilder::expression)
pub fn build(self) -> ::std::result::Result<crate::types::AttributeDetails, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::AttributeDetails {
attributes: self.attributes.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"attributes",
"attributes was not specified but it is required when building AttributeDetails",
)
})?,
expression: self.expression.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"expression",
"expression was not specified but it is required when building AttributeDetails",
)
})?,
})
}
}
impl ::std::fmt::Debug for AttributeDetailsBuilder {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("AttributeDetailsBuilder");
formatter.field("attributes", &"*** Sensitive Data Redacted ***");
formatter.field("expression", &"*** Sensitive Data Redacted ***");
formatter.finish()
}
}