aws_sdk_licensemanager/types/
_license_specification.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Details for associating a license configuration with a resource.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct LicenseSpecification {
7    /// <p>Amazon Resource Name (ARN) of the license configuration.</p>
8    pub license_configuration_arn: ::std::string::String,
9    /// <p>Scope of AMI associations. The possible value is <code>cross-account</code>.</p>
10    pub ami_association_scope: ::std::option::Option<::std::string::String>,
11}
12impl LicenseSpecification {
13    /// <p>Amazon Resource Name (ARN) of the license configuration.</p>
14    pub fn license_configuration_arn(&self) -> &str {
15        use std::ops::Deref;
16        self.license_configuration_arn.deref()
17    }
18    /// <p>Scope of AMI associations. The possible value is <code>cross-account</code>.</p>
19    pub fn ami_association_scope(&self) -> ::std::option::Option<&str> {
20        self.ami_association_scope.as_deref()
21    }
22}
23impl LicenseSpecification {
24    /// Creates a new builder-style object to manufacture [`LicenseSpecification`](crate::types::LicenseSpecification).
25    pub fn builder() -> crate::types::builders::LicenseSpecificationBuilder {
26        crate::types::builders::LicenseSpecificationBuilder::default()
27    }
28}
29
30/// A builder for [`LicenseSpecification`](crate::types::LicenseSpecification).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct LicenseSpecificationBuilder {
34    pub(crate) license_configuration_arn: ::std::option::Option<::std::string::String>,
35    pub(crate) ami_association_scope: ::std::option::Option<::std::string::String>,
36}
37impl LicenseSpecificationBuilder {
38    /// <p>Amazon Resource Name (ARN) of the license configuration.</p>
39    /// This field is required.
40    pub fn license_configuration_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.license_configuration_arn = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>Amazon Resource Name (ARN) of the license configuration.</p>
45    pub fn set_license_configuration_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.license_configuration_arn = input;
47        self
48    }
49    /// <p>Amazon Resource Name (ARN) of the license configuration.</p>
50    pub fn get_license_configuration_arn(&self) -> &::std::option::Option<::std::string::String> {
51        &self.license_configuration_arn
52    }
53    /// <p>Scope of AMI associations. The possible value is <code>cross-account</code>.</p>
54    pub fn ami_association_scope(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55        self.ami_association_scope = ::std::option::Option::Some(input.into());
56        self
57    }
58    /// <p>Scope of AMI associations. The possible value is <code>cross-account</code>.</p>
59    pub fn set_ami_association_scope(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60        self.ami_association_scope = input;
61        self
62    }
63    /// <p>Scope of AMI associations. The possible value is <code>cross-account</code>.</p>
64    pub fn get_ami_association_scope(&self) -> &::std::option::Option<::std::string::String> {
65        &self.ami_association_scope
66    }
67    /// Consumes the builder and constructs a [`LicenseSpecification`](crate::types::LicenseSpecification).
68    /// This method will fail if any of the following fields are not set:
69    /// - [`license_configuration_arn`](crate::types::builders::LicenseSpecificationBuilder::license_configuration_arn)
70    pub fn build(self) -> ::std::result::Result<crate::types::LicenseSpecification, ::aws_smithy_types::error::operation::BuildError> {
71        ::std::result::Result::Ok(crate::types::LicenseSpecification {
72            license_configuration_arn: self.license_configuration_arn.ok_or_else(|| {
73                ::aws_smithy_types::error::operation::BuildError::missing_field(
74                    "license_configuration_arn",
75                    "license_configuration_arn was not specified but it is required when building LicenseSpecification",
76                )
77            })?,
78            ami_association_scope: self.ami_association_scope,
79        })
80    }
81}