#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Property {
pub name: ::std::string::String,
pub description: ::std::string::String,
pub required: bool,
pub default_value: ::std::option::Option<::std::string::String>,
pub property_types: ::std::vec::Vec<crate::types::PropertyType>,
pub allowed_values: ::std::option::Option<::std::vec::Vec<crate::types::AllowedValue>>,
pub data_operation_scopes: ::std::option::Option<::std::vec::Vec<crate::types::DataOperation>>,
pub key_override: ::std::option::Option<::std::string::String>,
pub property_location: ::std::option::Option<crate::types::PropertyLocation>,
}
impl Property {
pub fn name(&self) -> &str {
use std::ops::Deref;
self.name.deref()
}
pub fn description(&self) -> &str {
use std::ops::Deref;
self.description.deref()
}
pub fn required(&self) -> bool {
self.required
}
pub fn default_value(&self) -> ::std::option::Option<&str> {
self.default_value.as_deref()
}
pub fn property_types(&self) -> &[crate::types::PropertyType] {
use std::ops::Deref;
self.property_types.deref()
}
pub fn allowed_values(&self) -> &[crate::types::AllowedValue] {
self.allowed_values.as_deref().unwrap_or_default()
}
pub fn data_operation_scopes(&self) -> &[crate::types::DataOperation] {
self.data_operation_scopes.as_deref().unwrap_or_default()
}
pub fn key_override(&self) -> ::std::option::Option<&str> {
self.key_override.as_deref()
}
pub fn property_location(&self) -> ::std::option::Option<&crate::types::PropertyLocation> {
self.property_location.as_ref()
}
}
impl Property {
pub fn builder() -> crate::types::builders::PropertyBuilder {
crate::types::builders::PropertyBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PropertyBuilder {
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) description: ::std::option::Option<::std::string::String>,
pub(crate) required: ::std::option::Option<bool>,
pub(crate) default_value: ::std::option::Option<::std::string::String>,
pub(crate) property_types: ::std::option::Option<::std::vec::Vec<crate::types::PropertyType>>,
pub(crate) allowed_values: ::std::option::Option<::std::vec::Vec<crate::types::AllowedValue>>,
pub(crate) data_operation_scopes: ::std::option::Option<::std::vec::Vec<crate::types::DataOperation>>,
pub(crate) key_override: ::std::option::Option<::std::string::String>,
pub(crate) property_location: ::std::option::Option<crate::types::PropertyLocation>,
}
impl PropertyBuilder {
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.name = ::std::option::Option::Some(input.into());
self
}
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.name = input;
self
}
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
&self.name
}
pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.description = ::std::option::Option::Some(input.into());
self
}
pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.description = input;
self
}
pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
&self.description
}
pub fn required(mut self, input: bool) -> Self {
self.required = ::std::option::Option::Some(input);
self
}
pub fn set_required(mut self, input: ::std::option::Option<bool>) -> Self {
self.required = input;
self
}
pub fn get_required(&self) -> &::std::option::Option<bool> {
&self.required
}
pub fn default_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.default_value = ::std::option::Option::Some(input.into());
self
}
pub fn set_default_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.default_value = input;
self
}
pub fn get_default_value(&self) -> &::std::option::Option<::std::string::String> {
&self.default_value
}
pub fn property_types(mut self, input: crate::types::PropertyType) -> Self {
let mut v = self.property_types.unwrap_or_default();
v.push(input);
self.property_types = ::std::option::Option::Some(v);
self
}
pub fn set_property_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PropertyType>>) -> Self {
self.property_types = input;
self
}
pub fn get_property_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PropertyType>> {
&self.property_types
}
pub fn allowed_values(mut self, input: crate::types::AllowedValue) -> Self {
let mut v = self.allowed_values.unwrap_or_default();
v.push(input);
self.allowed_values = ::std::option::Option::Some(v);
self
}
pub fn set_allowed_values(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AllowedValue>>) -> Self {
self.allowed_values = input;
self
}
pub fn get_allowed_values(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AllowedValue>> {
&self.allowed_values
}
pub fn data_operation_scopes(mut self, input: crate::types::DataOperation) -> Self {
let mut v = self.data_operation_scopes.unwrap_or_default();
v.push(input);
self.data_operation_scopes = ::std::option::Option::Some(v);
self
}
pub fn set_data_operation_scopes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DataOperation>>) -> Self {
self.data_operation_scopes = input;
self
}
pub fn get_data_operation_scopes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DataOperation>> {
&self.data_operation_scopes
}
pub fn key_override(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.key_override = ::std::option::Option::Some(input.into());
self
}
pub fn set_key_override(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.key_override = input;
self
}
pub fn get_key_override(&self) -> &::std::option::Option<::std::string::String> {
&self.key_override
}
pub fn property_location(mut self, input: crate::types::PropertyLocation) -> Self {
self.property_location = ::std::option::Option::Some(input);
self
}
pub fn set_property_location(mut self, input: ::std::option::Option<crate::types::PropertyLocation>) -> Self {
self.property_location = input;
self
}
pub fn get_property_location(&self) -> &::std::option::Option<crate::types::PropertyLocation> {
&self.property_location
}
pub fn build(self) -> ::std::result::Result<crate::types::Property, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Property {
name: self.name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"name",
"name was not specified but it is required when building Property",
)
})?,
description: self.description.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"description",
"description was not specified but it is required when building Property",
)
})?,
required: self.required.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"required",
"required was not specified but it is required when building Property",
)
})?,
default_value: self.default_value,
property_types: self.property_types.unwrap_or_default(),
allowed_values: self.allowed_values,
data_operation_scopes: self.data_operation_scopes,
key_override: self.key_override,
property_location: self.property_location,
})
}
}