#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Grant {
pub grant_arn: ::std::string::String,
pub grant_name: ::std::string::String,
pub parent_arn: ::std::string::String,
pub license_arn: ::std::string::String,
pub grantee_principal_arn: ::std::string::String,
pub home_region: ::std::string::String,
pub grant_status: crate::types::GrantStatus,
pub status_reason: ::std::option::Option<::std::string::String>,
pub version: ::std::string::String,
pub granted_operations: ::std::vec::Vec<crate::types::AllowedOperation>,
pub options: ::std::option::Option<crate::types::Options>,
}
impl Grant {
pub fn grant_arn(&self) -> &str {
use std::ops::Deref;
self.grant_arn.deref()
}
pub fn grant_name(&self) -> &str {
use std::ops::Deref;
self.grant_name.deref()
}
pub fn parent_arn(&self) -> &str {
use std::ops::Deref;
self.parent_arn.deref()
}
pub fn license_arn(&self) -> &str {
use std::ops::Deref;
self.license_arn.deref()
}
pub fn grantee_principal_arn(&self) -> &str {
use std::ops::Deref;
self.grantee_principal_arn.deref()
}
pub fn home_region(&self) -> &str {
use std::ops::Deref;
self.home_region.deref()
}
pub fn grant_status(&self) -> &crate::types::GrantStatus {
&self.grant_status
}
pub fn status_reason(&self) -> ::std::option::Option<&str> {
self.status_reason.as_deref()
}
pub fn version(&self) -> &str {
use std::ops::Deref;
self.version.deref()
}
pub fn granted_operations(&self) -> &[crate::types::AllowedOperation] {
use std::ops::Deref;
self.granted_operations.deref()
}
pub fn options(&self) -> ::std::option::Option<&crate::types::Options> {
self.options.as_ref()
}
}
impl Grant {
pub fn builder() -> crate::types::builders::GrantBuilder {
crate::types::builders::GrantBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GrantBuilder {
pub(crate) grant_arn: ::std::option::Option<::std::string::String>,
pub(crate) grant_name: ::std::option::Option<::std::string::String>,
pub(crate) parent_arn: ::std::option::Option<::std::string::String>,
pub(crate) license_arn: ::std::option::Option<::std::string::String>,
pub(crate) grantee_principal_arn: ::std::option::Option<::std::string::String>,
pub(crate) home_region: ::std::option::Option<::std::string::String>,
pub(crate) grant_status: ::std::option::Option<crate::types::GrantStatus>,
pub(crate) status_reason: ::std::option::Option<::std::string::String>,
pub(crate) version: ::std::option::Option<::std::string::String>,
pub(crate) granted_operations: ::std::option::Option<::std::vec::Vec<crate::types::AllowedOperation>>,
pub(crate) options: ::std::option::Option<crate::types::Options>,
}
impl GrantBuilder {
pub fn grant_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.grant_arn = ::std::option::Option::Some(input.into());
self
}
pub fn set_grant_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.grant_arn = input;
self
}
pub fn get_grant_arn(&self) -> &::std::option::Option<::std::string::String> {
&self.grant_arn
}
pub fn grant_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.grant_name = ::std::option::Option::Some(input.into());
self
}
pub fn set_grant_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.grant_name = input;
self
}
pub fn get_grant_name(&self) -> &::std::option::Option<::std::string::String> {
&self.grant_name
}
pub fn parent_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.parent_arn = ::std::option::Option::Some(input.into());
self
}
pub fn set_parent_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.parent_arn = input;
self
}
pub fn get_parent_arn(&self) -> &::std::option::Option<::std::string::String> {
&self.parent_arn
}
pub fn license_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.license_arn = ::std::option::Option::Some(input.into());
self
}
pub fn set_license_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.license_arn = input;
self
}
pub fn get_license_arn(&self) -> &::std::option::Option<::std::string::String> {
&self.license_arn
}
pub fn grantee_principal_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.grantee_principal_arn = ::std::option::Option::Some(input.into());
self
}
pub fn set_grantee_principal_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.grantee_principal_arn = input;
self
}
pub fn get_grantee_principal_arn(&self) -> &::std::option::Option<::std::string::String> {
&self.grantee_principal_arn
}
pub fn home_region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.home_region = ::std::option::Option::Some(input.into());
self
}
pub fn set_home_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.home_region = input;
self
}
pub fn get_home_region(&self) -> &::std::option::Option<::std::string::String> {
&self.home_region
}
pub fn grant_status(mut self, input: crate::types::GrantStatus) -> Self {
self.grant_status = ::std::option::Option::Some(input);
self
}
pub fn set_grant_status(mut self, input: ::std::option::Option<crate::types::GrantStatus>) -> Self {
self.grant_status = input;
self
}
pub fn get_grant_status(&self) -> &::std::option::Option<crate::types::GrantStatus> {
&self.grant_status
}
pub fn status_reason(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.status_reason = ::std::option::Option::Some(input.into());
self
}
pub fn set_status_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.status_reason = input;
self
}
pub fn get_status_reason(&self) -> &::std::option::Option<::std::string::String> {
&self.status_reason
}
pub fn version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.version = ::std::option::Option::Some(input.into());
self
}
pub fn set_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.version = input;
self
}
pub fn get_version(&self) -> &::std::option::Option<::std::string::String> {
&self.version
}
pub fn granted_operations(mut self, input: crate::types::AllowedOperation) -> Self {
let mut v = self.granted_operations.unwrap_or_default();
v.push(input);
self.granted_operations = ::std::option::Option::Some(v);
self
}
pub fn set_granted_operations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AllowedOperation>>) -> Self {
self.granted_operations = input;
self
}
pub fn get_granted_operations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AllowedOperation>> {
&self.granted_operations
}
pub fn options(mut self, input: crate::types::Options) -> Self {
self.options = ::std::option::Option::Some(input);
self
}
pub fn set_options(mut self, input: ::std::option::Option<crate::types::Options>) -> Self {
self.options = input;
self
}
pub fn get_options(&self) -> &::std::option::Option<crate::types::Options> {
&self.options
}
pub fn build(self) -> ::std::result::Result<crate::types::Grant, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Grant {
grant_arn: self.grant_arn.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"grant_arn",
"grant_arn was not specified but it is required when building Grant",
)
})?,
grant_name: self.grant_name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"grant_name",
"grant_name was not specified but it is required when building Grant",
)
})?,
parent_arn: self.parent_arn.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"parent_arn",
"parent_arn was not specified but it is required when building Grant",
)
})?,
license_arn: self.license_arn.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"license_arn",
"license_arn was not specified but it is required when building Grant",
)
})?,
grantee_principal_arn: self.grantee_principal_arn.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"grantee_principal_arn",
"grantee_principal_arn was not specified but it is required when building Grant",
)
})?,
home_region: self.home_region.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"home_region",
"home_region was not specified but it is required when building Grant",
)
})?,
grant_status: self.grant_status.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"grant_status",
"grant_status was not specified but it is required when building Grant",
)
})?,
status_reason: self.status_reason,
version: self.version.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"version",
"version was not specified but it is required when building Grant",
)
})?,
granted_operations: self.granted_operations.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"granted_operations",
"granted_operations was not specified but it is required when building Grant",
)
})?,
options: self.options,
})
}
}