aws-sdk-licensemanager 1.95.0

AWS SDK for AWS License Manager
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Describes a grant.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Grant {
    /// <p>Amazon Resource Name (ARN) of the grant.</p>
    pub grant_arn: ::std::string::String,
    /// <p>Grant name.</p>
    pub grant_name: ::std::string::String,
    /// <p>Parent ARN.</p>
    pub parent_arn: ::std::string::String,
    /// <p>License ARN.</p>
    pub license_arn: ::std::string::String,
    /// <p>The grantee principal ARN.</p>
    pub grantee_principal_arn: ::std::string::String,
    /// <p>Home Region of the grant.</p>
    pub home_region: ::std::string::String,
    /// <p>Grant status.</p>
    pub grant_status: crate::types::GrantStatus,
    /// <p>Grant status reason.</p>
    pub status_reason: ::std::option::Option<::std::string::String>,
    /// <p>Grant version.</p>
    pub version: ::std::string::String,
    /// <p>Granted operations.</p>
    pub granted_operations: ::std::vec::Vec<crate::types::AllowedOperation>,
    /// <p>The options specified for the grant.</p>
    pub options: ::std::option::Option<crate::types::Options>,
}
impl Grant {
    /// <p>Amazon Resource Name (ARN) of the grant.</p>
    pub fn grant_arn(&self) -> &str {
        use std::ops::Deref;
        self.grant_arn.deref()
    }
    /// <p>Grant name.</p>
    pub fn grant_name(&self) -> &str {
        use std::ops::Deref;
        self.grant_name.deref()
    }
    /// <p>Parent ARN.</p>
    pub fn parent_arn(&self) -> &str {
        use std::ops::Deref;
        self.parent_arn.deref()
    }
    /// <p>License ARN.</p>
    pub fn license_arn(&self) -> &str {
        use std::ops::Deref;
        self.license_arn.deref()
    }
    /// <p>The grantee principal ARN.</p>
    pub fn grantee_principal_arn(&self) -> &str {
        use std::ops::Deref;
        self.grantee_principal_arn.deref()
    }
    /// <p>Home Region of the grant.</p>
    pub fn home_region(&self) -> &str {
        use std::ops::Deref;
        self.home_region.deref()
    }
    /// <p>Grant status.</p>
    pub fn grant_status(&self) -> &crate::types::GrantStatus {
        &self.grant_status
    }
    /// <p>Grant status reason.</p>
    pub fn status_reason(&self) -> ::std::option::Option<&str> {
        self.status_reason.as_deref()
    }
    /// <p>Grant version.</p>
    pub fn version(&self) -> &str {
        use std::ops::Deref;
        self.version.deref()
    }
    /// <p>Granted operations.</p>
    pub fn granted_operations(&self) -> &[crate::types::AllowedOperation] {
        use std::ops::Deref;
        self.granted_operations.deref()
    }
    /// <p>The options specified for the grant.</p>
    pub fn options(&self) -> ::std::option::Option<&crate::types::Options> {
        self.options.as_ref()
    }
}
impl Grant {
    /// Creates a new builder-style object to manufacture [`Grant`](crate::types::Grant).
    pub fn builder() -> crate::types::builders::GrantBuilder {
        crate::types::builders::GrantBuilder::default()
    }
}

/// A builder for [`Grant`](crate::types::Grant).
#[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 {
    /// <p>Amazon Resource Name (ARN) of the grant.</p>
    /// This field is required.
    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
    }
    /// <p>Amazon Resource Name (ARN) of the grant.</p>
    pub fn set_grant_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.grant_arn = input;
        self
    }
    /// <p>Amazon Resource Name (ARN) of the grant.</p>
    pub fn get_grant_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.grant_arn
    }
    /// <p>Grant name.</p>
    /// This field is required.
    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
    }
    /// <p>Grant name.</p>
    pub fn set_grant_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.grant_name = input;
        self
    }
    /// <p>Grant name.</p>
    pub fn get_grant_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.grant_name
    }
    /// <p>Parent ARN.</p>
    /// This field is required.
    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
    }
    /// <p>Parent ARN.</p>
    pub fn set_parent_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.parent_arn = input;
        self
    }
    /// <p>Parent ARN.</p>
    pub fn get_parent_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.parent_arn
    }
    /// <p>License ARN.</p>
    /// This field is required.
    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
    }
    /// <p>License ARN.</p>
    pub fn set_license_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.license_arn = input;
        self
    }
    /// <p>License ARN.</p>
    pub fn get_license_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.license_arn
    }
    /// <p>The grantee principal ARN.</p>
    /// This field is required.
    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
    }
    /// <p>The grantee principal ARN.</p>
    pub fn set_grantee_principal_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.grantee_principal_arn = input;
        self
    }
    /// <p>The grantee principal ARN.</p>
    pub fn get_grantee_principal_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.grantee_principal_arn
    }
    /// <p>Home Region of the grant.</p>
    /// This field is required.
    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
    }
    /// <p>Home Region of the grant.</p>
    pub fn set_home_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.home_region = input;
        self
    }
    /// <p>Home Region of the grant.</p>
    pub fn get_home_region(&self) -> &::std::option::Option<::std::string::String> {
        &self.home_region
    }
    /// <p>Grant status.</p>
    /// This field is required.
    pub fn grant_status(mut self, input: crate::types::GrantStatus) -> Self {
        self.grant_status = ::std::option::Option::Some(input);
        self
    }
    /// <p>Grant status.</p>
    pub fn set_grant_status(mut self, input: ::std::option::Option<crate::types::GrantStatus>) -> Self {
        self.grant_status = input;
        self
    }
    /// <p>Grant status.</p>
    pub fn get_grant_status(&self) -> &::std::option::Option<crate::types::GrantStatus> {
        &self.grant_status
    }
    /// <p>Grant status reason.</p>
    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
    }
    /// <p>Grant status reason.</p>
    pub fn set_status_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.status_reason = input;
        self
    }
    /// <p>Grant status reason.</p>
    pub fn get_status_reason(&self) -> &::std::option::Option<::std::string::String> {
        &self.status_reason
    }
    /// <p>Grant version.</p>
    /// This field is required.
    pub fn version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.version = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Grant version.</p>
    pub fn set_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.version = input;
        self
    }
    /// <p>Grant version.</p>
    pub fn get_version(&self) -> &::std::option::Option<::std::string::String> {
        &self.version
    }
    /// Appends an item to `granted_operations`.
    ///
    /// To override the contents of this collection use [`set_granted_operations`](Self::set_granted_operations).
    ///
    /// <p>Granted operations.</p>
    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
    }
    /// <p>Granted operations.</p>
    pub fn set_granted_operations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AllowedOperation>>) -> Self {
        self.granted_operations = input;
        self
    }
    /// <p>Granted operations.</p>
    pub fn get_granted_operations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AllowedOperation>> {
        &self.granted_operations
    }
    /// <p>The options specified for the grant.</p>
    pub fn options(mut self, input: crate::types::Options) -> Self {
        self.options = ::std::option::Option::Some(input);
        self
    }
    /// <p>The options specified for the grant.</p>
    pub fn set_options(mut self, input: ::std::option::Option<crate::types::Options>) -> Self {
        self.options = input;
        self
    }
    /// <p>The options specified for the grant.</p>
    pub fn get_options(&self) -> &::std::option::Option<crate::types::Options> {
        &self.options
    }
    /// Consumes the builder and constructs a [`Grant`](crate::types::Grant).
    /// This method will fail if any of the following fields are not set:
    /// - [`grant_arn`](crate::types::builders::GrantBuilder::grant_arn)
    /// - [`grant_name`](crate::types::builders::GrantBuilder::grant_name)
    /// - [`parent_arn`](crate::types::builders::GrantBuilder::parent_arn)
    /// - [`license_arn`](crate::types::builders::GrantBuilder::license_arn)
    /// - [`grantee_principal_arn`](crate::types::builders::GrantBuilder::grantee_principal_arn)
    /// - [`home_region`](crate::types::builders::GrantBuilder::home_region)
    /// - [`grant_status`](crate::types::builders::GrantBuilder::grant_status)
    /// - [`version`](crate::types::builders::GrantBuilder::version)
    /// - [`granted_operations`](crate::types::builders::GrantBuilder::granted_operations)
    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,
        })
    }
}