aws_sdk_licensemanager/operation/create_token/
_create_token_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateTokenInput {
6    /// <p>Amazon Resource Name (ARN) of the license. The ARN is mapped to the aud claim of the JWT token.</p>
7    pub license_arn: ::std::option::Option<::std::string::String>,
8    /// <p>Amazon Resource Name (ARN) of the IAM roles to embed in the token. License Manager does not check whether the roles are in use.</p>
9    pub role_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10    /// <p>Token expiration, in days, counted from token creation. The default is 365 days.</p>
11    pub expiration_in_days: ::std::option::Option<i32>,
12    /// <p>Data specified by the caller to be included in the JWT token. The data is mapped to the amr claim of the JWT token.</p>
13    pub token_properties: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
14    /// <p>Idempotency token, valid for 10 minutes.</p>
15    pub client_token: ::std::option::Option<::std::string::String>,
16}
17impl CreateTokenInput {
18    /// <p>Amazon Resource Name (ARN) of the license. The ARN is mapped to the aud claim of the JWT token.</p>
19    pub fn license_arn(&self) -> ::std::option::Option<&str> {
20        self.license_arn.as_deref()
21    }
22    /// <p>Amazon Resource Name (ARN) of the IAM roles to embed in the token. License Manager does not check whether the roles are in use.</p>
23    ///
24    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.role_arns.is_none()`.
25    pub fn role_arns(&self) -> &[::std::string::String] {
26        self.role_arns.as_deref().unwrap_or_default()
27    }
28    /// <p>Token expiration, in days, counted from token creation. The default is 365 days.</p>
29    pub fn expiration_in_days(&self) -> ::std::option::Option<i32> {
30        self.expiration_in_days
31    }
32    /// <p>Data specified by the caller to be included in the JWT token. The data is mapped to the amr claim of the JWT token.</p>
33    ///
34    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.token_properties.is_none()`.
35    pub fn token_properties(&self) -> &[::std::string::String] {
36        self.token_properties.as_deref().unwrap_or_default()
37    }
38    /// <p>Idempotency token, valid for 10 minutes.</p>
39    pub fn client_token(&self) -> ::std::option::Option<&str> {
40        self.client_token.as_deref()
41    }
42}
43impl CreateTokenInput {
44    /// Creates a new builder-style object to manufacture [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
45    pub fn builder() -> crate::operation::create_token::builders::CreateTokenInputBuilder {
46        crate::operation::create_token::builders::CreateTokenInputBuilder::default()
47    }
48}
49
50/// A builder for [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
51#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
52#[non_exhaustive]
53pub struct CreateTokenInputBuilder {
54    pub(crate) license_arn: ::std::option::Option<::std::string::String>,
55    pub(crate) role_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
56    pub(crate) expiration_in_days: ::std::option::Option<i32>,
57    pub(crate) token_properties: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
58    pub(crate) client_token: ::std::option::Option<::std::string::String>,
59}
60impl CreateTokenInputBuilder {
61    /// <p>Amazon Resource Name (ARN) of the license. The ARN is mapped to the aud claim of the JWT token.</p>
62    /// This field is required.
63    pub fn license_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.license_arn = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <p>Amazon Resource Name (ARN) of the license. The ARN is mapped to the aud claim of the JWT token.</p>
68    pub fn set_license_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.license_arn = input;
70        self
71    }
72    /// <p>Amazon Resource Name (ARN) of the license. The ARN is mapped to the aud claim of the JWT token.</p>
73    pub fn get_license_arn(&self) -> &::std::option::Option<::std::string::String> {
74        &self.license_arn
75    }
76    /// Appends an item to `role_arns`.
77    ///
78    /// To override the contents of this collection use [`set_role_arns`](Self::set_role_arns).
79    ///
80    /// <p>Amazon Resource Name (ARN) of the IAM roles to embed in the token. License Manager does not check whether the roles are in use.</p>
81    pub fn role_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82        let mut v = self.role_arns.unwrap_or_default();
83        v.push(input.into());
84        self.role_arns = ::std::option::Option::Some(v);
85        self
86    }
87    /// <p>Amazon Resource Name (ARN) of the IAM roles to embed in the token. License Manager does not check whether the roles are in use.</p>
88    pub fn set_role_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
89        self.role_arns = input;
90        self
91    }
92    /// <p>Amazon Resource Name (ARN) of the IAM roles to embed in the token. License Manager does not check whether the roles are in use.</p>
93    pub fn get_role_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
94        &self.role_arns
95    }
96    /// <p>Token expiration, in days, counted from token creation. The default is 365 days.</p>
97    pub fn expiration_in_days(mut self, input: i32) -> Self {
98        self.expiration_in_days = ::std::option::Option::Some(input);
99        self
100    }
101    /// <p>Token expiration, in days, counted from token creation. The default is 365 days.</p>
102    pub fn set_expiration_in_days(mut self, input: ::std::option::Option<i32>) -> Self {
103        self.expiration_in_days = input;
104        self
105    }
106    /// <p>Token expiration, in days, counted from token creation. The default is 365 days.</p>
107    pub fn get_expiration_in_days(&self) -> &::std::option::Option<i32> {
108        &self.expiration_in_days
109    }
110    /// Appends an item to `token_properties`.
111    ///
112    /// To override the contents of this collection use [`set_token_properties`](Self::set_token_properties).
113    ///
114    /// <p>Data specified by the caller to be included in the JWT token. The data is mapped to the amr claim of the JWT token.</p>
115    pub fn token_properties(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        let mut v = self.token_properties.unwrap_or_default();
117        v.push(input.into());
118        self.token_properties = ::std::option::Option::Some(v);
119        self
120    }
121    /// <p>Data specified by the caller to be included in the JWT token. The data is mapped to the amr claim of the JWT token.</p>
122    pub fn set_token_properties(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
123        self.token_properties = input;
124        self
125    }
126    /// <p>Data specified by the caller to be included in the JWT token. The data is mapped to the amr claim of the JWT token.</p>
127    pub fn get_token_properties(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
128        &self.token_properties
129    }
130    /// <p>Idempotency token, valid for 10 minutes.</p>
131    /// This field is required.
132    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        self.client_token = ::std::option::Option::Some(input.into());
134        self
135    }
136    /// <p>Idempotency token, valid for 10 minutes.</p>
137    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.client_token = input;
139        self
140    }
141    /// <p>Idempotency token, valid for 10 minutes.</p>
142    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
143        &self.client_token
144    }
145    /// Consumes the builder and constructs a [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
146    pub fn build(self) -> ::std::result::Result<crate::operation::create_token::CreateTokenInput, ::aws_smithy_types::error::operation::BuildError> {
147        ::std::result::Result::Ok(crate::operation::create_token::CreateTokenInput {
148            license_arn: self.license_arn,
149            role_arns: self.role_arns,
150            expiration_in_days: self.expiration_in_days,
151            token_properties: self.token_properties,
152            client_token: self.client_token,
153        })
154    }
155}