aws_sdk_acmpca/operation/create_permission/
_create_permission_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 CreatePermissionInput {
6    /// <p>The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListCertificateAuthorities.html">ListCertificateAuthorities</a> action. This must have the following form:</p>
7    /// <p><code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code>.</p>
8    pub certificate_authority_arn: ::std::option::Option<::std::string::String>,
9    /// <p>The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal is <code>acm.amazonaws.com</code>.</p>
10    pub principal: ::std::option::Option<::std::string::String>,
11    /// <p>The ID of the calling account.</p>
12    pub source_account: ::std::option::Option<::std::string::String>,
13    /// <p>The actions that the specified Amazon Web Services service principal can use. These include <code>IssueCertificate</code>, <code>GetCertificate</code>, and <code>ListPermissions</code>.</p>
14    pub actions: ::std::option::Option<::std::vec::Vec<crate::types::ActionType>>,
15}
16impl CreatePermissionInput {
17    /// <p>The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListCertificateAuthorities.html">ListCertificateAuthorities</a> action. This must have the following form:</p>
18    /// <p><code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code>.</p>
19    pub fn certificate_authority_arn(&self) -> ::std::option::Option<&str> {
20        self.certificate_authority_arn.as_deref()
21    }
22    /// <p>The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal is <code>acm.amazonaws.com</code>.</p>
23    pub fn principal(&self) -> ::std::option::Option<&str> {
24        self.principal.as_deref()
25    }
26    /// <p>The ID of the calling account.</p>
27    pub fn source_account(&self) -> ::std::option::Option<&str> {
28        self.source_account.as_deref()
29    }
30    /// <p>The actions that the specified Amazon Web Services service principal can use. These include <code>IssueCertificate</code>, <code>GetCertificate</code>, and <code>ListPermissions</code>.</p>
31    ///
32    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.actions.is_none()`.
33    pub fn actions(&self) -> &[crate::types::ActionType] {
34        self.actions.as_deref().unwrap_or_default()
35    }
36}
37impl CreatePermissionInput {
38    /// Creates a new builder-style object to manufacture [`CreatePermissionInput`](crate::operation::create_permission::CreatePermissionInput).
39    pub fn builder() -> crate::operation::create_permission::builders::CreatePermissionInputBuilder {
40        crate::operation::create_permission::builders::CreatePermissionInputBuilder::default()
41    }
42}
43
44/// A builder for [`CreatePermissionInput`](crate::operation::create_permission::CreatePermissionInput).
45#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
46#[non_exhaustive]
47pub struct CreatePermissionInputBuilder {
48    pub(crate) certificate_authority_arn: ::std::option::Option<::std::string::String>,
49    pub(crate) principal: ::std::option::Option<::std::string::String>,
50    pub(crate) source_account: ::std::option::Option<::std::string::String>,
51    pub(crate) actions: ::std::option::Option<::std::vec::Vec<crate::types::ActionType>>,
52}
53impl CreatePermissionInputBuilder {
54    /// <p>The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListCertificateAuthorities.html">ListCertificateAuthorities</a> action. This must have the following form:</p>
55    /// <p><code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code>.</p>
56    /// This field is required.
57    pub fn certificate_authority_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
58        self.certificate_authority_arn = ::std::option::Option::Some(input.into());
59        self
60    }
61    /// <p>The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListCertificateAuthorities.html">ListCertificateAuthorities</a> action. This must have the following form:</p>
62    /// <p><code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code>.</p>
63    pub fn set_certificate_authority_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
64        self.certificate_authority_arn = input;
65        self
66    }
67    /// <p>The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListCertificateAuthorities.html">ListCertificateAuthorities</a> action. This must have the following form:</p>
68    /// <p><code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code>.</p>
69    pub fn get_certificate_authority_arn(&self) -> &::std::option::Option<::std::string::String> {
70        &self.certificate_authority_arn
71    }
72    /// <p>The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal is <code>acm.amazonaws.com</code>.</p>
73    /// This field is required.
74    pub fn principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
75        self.principal = ::std::option::Option::Some(input.into());
76        self
77    }
78    /// <p>The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal is <code>acm.amazonaws.com</code>.</p>
79    pub fn set_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
80        self.principal = input;
81        self
82    }
83    /// <p>The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal is <code>acm.amazonaws.com</code>.</p>
84    pub fn get_principal(&self) -> &::std::option::Option<::std::string::String> {
85        &self.principal
86    }
87    /// <p>The ID of the calling account.</p>
88    pub fn source_account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.source_account = ::std::option::Option::Some(input.into());
90        self
91    }
92    /// <p>The ID of the calling account.</p>
93    pub fn set_source_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.source_account = input;
95        self
96    }
97    /// <p>The ID of the calling account.</p>
98    pub fn get_source_account(&self) -> &::std::option::Option<::std::string::String> {
99        &self.source_account
100    }
101    /// Appends an item to `actions`.
102    ///
103    /// To override the contents of this collection use [`set_actions`](Self::set_actions).
104    ///
105    /// <p>The actions that the specified Amazon Web Services service principal can use. These include <code>IssueCertificate</code>, <code>GetCertificate</code>, and <code>ListPermissions</code>.</p>
106    pub fn actions(mut self, input: crate::types::ActionType) -> Self {
107        let mut v = self.actions.unwrap_or_default();
108        v.push(input);
109        self.actions = ::std::option::Option::Some(v);
110        self
111    }
112    /// <p>The actions that the specified Amazon Web Services service principal can use. These include <code>IssueCertificate</code>, <code>GetCertificate</code>, and <code>ListPermissions</code>.</p>
113    pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ActionType>>) -> Self {
114        self.actions = input;
115        self
116    }
117    /// <p>The actions that the specified Amazon Web Services service principal can use. These include <code>IssueCertificate</code>, <code>GetCertificate</code>, and <code>ListPermissions</code>.</p>
118    pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ActionType>> {
119        &self.actions
120    }
121    /// Consumes the builder and constructs a [`CreatePermissionInput`](crate::operation::create_permission::CreatePermissionInput).
122    pub fn build(
123        self,
124    ) -> ::std::result::Result<crate::operation::create_permission::CreatePermissionInput, ::aws_smithy_types::error::operation::BuildError> {
125        ::std::result::Result::Ok(crate::operation::create_permission::CreatePermissionInput {
126            certificate_authority_arn: self.certificate_authority_arn,
127            principal: self.principal,
128            source_account: self.source_account,
129            actions: self.actions,
130        })
131    }
132}