#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Entitlement {
pub name: ::std::string::String,
pub value: ::std::option::Option<::std::string::String>,
pub max_count: ::std::option::Option<i64>,
pub overage: ::std::option::Option<bool>,
pub unit: crate::types::EntitlementUnit,
pub allow_check_in: ::std::option::Option<bool>,
}
impl Entitlement {
pub fn name(&self) -> &str {
use std::ops::Deref;
self.name.deref()
}
pub fn value(&self) -> ::std::option::Option<&str> {
self.value.as_deref()
}
pub fn max_count(&self) -> ::std::option::Option<i64> {
self.max_count
}
pub fn overage(&self) -> ::std::option::Option<bool> {
self.overage
}
pub fn unit(&self) -> &crate::types::EntitlementUnit {
&self.unit
}
pub fn allow_check_in(&self) -> ::std::option::Option<bool> {
self.allow_check_in
}
}
impl Entitlement {
pub fn builder() -> crate::types::builders::EntitlementBuilder {
crate::types::builders::EntitlementBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct EntitlementBuilder {
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) value: ::std::option::Option<::std::string::String>,
pub(crate) max_count: ::std::option::Option<i64>,
pub(crate) overage: ::std::option::Option<bool>,
pub(crate) unit: ::std::option::Option<crate::types::EntitlementUnit>,
pub(crate) allow_check_in: ::std::option::Option<bool>,
}
impl EntitlementBuilder {
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 value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.value = ::std::option::Option::Some(input.into());
self
}
pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.value = input;
self
}
pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
&self.value
}
pub fn max_count(mut self, input: i64) -> Self {
self.max_count = ::std::option::Option::Some(input);
self
}
pub fn set_max_count(mut self, input: ::std::option::Option<i64>) -> Self {
self.max_count = input;
self
}
pub fn get_max_count(&self) -> &::std::option::Option<i64> {
&self.max_count
}
pub fn overage(mut self, input: bool) -> Self {
self.overage = ::std::option::Option::Some(input);
self
}
pub fn set_overage(mut self, input: ::std::option::Option<bool>) -> Self {
self.overage = input;
self
}
pub fn get_overage(&self) -> &::std::option::Option<bool> {
&self.overage
}
pub fn unit(mut self, input: crate::types::EntitlementUnit) -> Self {
self.unit = ::std::option::Option::Some(input);
self
}
pub fn set_unit(mut self, input: ::std::option::Option<crate::types::EntitlementUnit>) -> Self {
self.unit = input;
self
}
pub fn get_unit(&self) -> &::std::option::Option<crate::types::EntitlementUnit> {
&self.unit
}
pub fn allow_check_in(mut self, input: bool) -> Self {
self.allow_check_in = ::std::option::Option::Some(input);
self
}
pub fn set_allow_check_in(mut self, input: ::std::option::Option<bool>) -> Self {
self.allow_check_in = input;
self
}
pub fn get_allow_check_in(&self) -> &::std::option::Option<bool> {
&self.allow_check_in
}
pub fn build(self) -> ::std::result::Result<crate::types::Entitlement, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Entitlement {
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 Entitlement",
)
})?,
value: self.value,
max_count: self.max_count,
overage: self.overage,
unit: self.unit.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"unit",
"unit was not specified but it is required when building Entitlement",
)
})?,
allow_check_in: self.allow_check_in,
})
}
}