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 resource entitled for use with a license.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Entitlement {
    /// <p>Entitlement name.</p>
    pub name: ::std::string::String,
    /// <p>Entitlement resource. Use only if the unit is None.</p>
    pub value: ::std::option::Option<::std::string::String>,
    /// <p>Maximum entitlement count. Use if the unit is not None.</p>
    pub max_count: ::std::option::Option<i64>,
    /// <p>Indicates whether overages are allowed.</p>
    pub overage: ::std::option::Option<bool>,
    /// <p>Entitlement unit.</p>
    pub unit: crate::types::EntitlementUnit,
    /// <p>Indicates whether check-ins are allowed.</p>
    pub allow_check_in: ::std::option::Option<bool>,
}
impl Entitlement {
    /// <p>Entitlement name.</p>
    pub fn name(&self) -> &str {
        use std::ops::Deref;
        self.name.deref()
    }
    /// <p>Entitlement resource. Use only if the unit is None.</p>
    pub fn value(&self) -> ::std::option::Option<&str> {
        self.value.as_deref()
    }
    /// <p>Maximum entitlement count. Use if the unit is not None.</p>
    pub fn max_count(&self) -> ::std::option::Option<i64> {
        self.max_count
    }
    /// <p>Indicates whether overages are allowed.</p>
    pub fn overage(&self) -> ::std::option::Option<bool> {
        self.overage
    }
    /// <p>Entitlement unit.</p>
    pub fn unit(&self) -> &crate::types::EntitlementUnit {
        &self.unit
    }
    /// <p>Indicates whether check-ins are allowed.</p>
    pub fn allow_check_in(&self) -> ::std::option::Option<bool> {
        self.allow_check_in
    }
}
impl Entitlement {
    /// Creates a new builder-style object to manufacture [`Entitlement`](crate::types::Entitlement).
    pub fn builder() -> crate::types::builders::EntitlementBuilder {
        crate::types::builders::EntitlementBuilder::default()
    }
}

/// A builder for [`Entitlement`](crate::types::Entitlement).
#[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 {
    /// <p>Entitlement name.</p>
    /// This field is required.
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Entitlement name.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>Entitlement name.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>Entitlement resource. Use only if the unit is None.</p>
    pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.value = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Entitlement resource. Use only if the unit is None.</p>
    pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.value = input;
        self
    }
    /// <p>Entitlement resource. Use only if the unit is None.</p>
    pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
        &self.value
    }
    /// <p>Maximum entitlement count. Use if the unit is not None.</p>
    pub fn max_count(mut self, input: i64) -> Self {
        self.max_count = ::std::option::Option::Some(input);
        self
    }
    /// <p>Maximum entitlement count. Use if the unit is not None.</p>
    pub fn set_max_count(mut self, input: ::std::option::Option<i64>) -> Self {
        self.max_count = input;
        self
    }
    /// <p>Maximum entitlement count. Use if the unit is not None.</p>
    pub fn get_max_count(&self) -> &::std::option::Option<i64> {
        &self.max_count
    }
    /// <p>Indicates whether overages are allowed.</p>
    pub fn overage(mut self, input: bool) -> Self {
        self.overage = ::std::option::Option::Some(input);
        self
    }
    /// <p>Indicates whether overages are allowed.</p>
    pub fn set_overage(mut self, input: ::std::option::Option<bool>) -> Self {
        self.overage = input;
        self
    }
    /// <p>Indicates whether overages are allowed.</p>
    pub fn get_overage(&self) -> &::std::option::Option<bool> {
        &self.overage
    }
    /// <p>Entitlement unit.</p>
    /// This field is required.
    pub fn unit(mut self, input: crate::types::EntitlementUnit) -> Self {
        self.unit = ::std::option::Option::Some(input);
        self
    }
    /// <p>Entitlement unit.</p>
    pub fn set_unit(mut self, input: ::std::option::Option<crate::types::EntitlementUnit>) -> Self {
        self.unit = input;
        self
    }
    /// <p>Entitlement unit.</p>
    pub fn get_unit(&self) -> &::std::option::Option<crate::types::EntitlementUnit> {
        &self.unit
    }
    /// <p>Indicates whether check-ins are allowed.</p>
    pub fn allow_check_in(mut self, input: bool) -> Self {
        self.allow_check_in = ::std::option::Option::Some(input);
        self
    }
    /// <p>Indicates whether check-ins are allowed.</p>
    pub fn set_allow_check_in(mut self, input: ::std::option::Option<bool>) -> Self {
        self.allow_check_in = input;
        self
    }
    /// <p>Indicates whether check-ins are allowed.</p>
    pub fn get_allow_check_in(&self) -> &::std::option::Option<bool> {
        &self.allow_check_in
    }
    /// Consumes the builder and constructs a [`Entitlement`](crate::types::Entitlement).
    /// This method will fail if any of the following fields are not set:
    /// - [`name`](crate::types::builders::EntitlementBuilder::name)
    /// - [`unit`](crate::types::builders::EntitlementBuilder::unit)
    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,
        })
    }
}