1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A proposed grant configuration for a KMS key. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_CreateGrant.html">CreateGrant</a>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct KmsGrantConfiguration {
    /// <p>A list of operations that the grant permits.</p>
    pub operations: ::std::option::Option<::std::vec::Vec<crate::types::KmsGrantOperation>>,
    /// <p>The principal that is given permission to perform the operations that the grant permits.</p>
    pub grantee_principal: ::std::option::Option<::std::string::String>,
    /// <p>The principal that is given permission to retire the grant by using <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_RetireGrant.html">RetireGrant</a> operation.</p>
    pub retiring_principal: ::std::option::Option<::std::string::String>,
    /// <p>Use this structure to propose allowing <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> in the grant only when the operation request includes the specified <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">encryption context</a>.</p>
    pub constraints: ::std::option::Option<crate::types::KmsGrantConstraints>,
    /// <p> The Amazon Web Services account under which the grant was issued. The account is used to propose KMS grants issued by accounts other than the owner of the key.</p>
    pub issuing_account: ::std::option::Option<::std::string::String>,
}
impl KmsGrantConfiguration {
    /// <p>A list of operations that the grant permits.</p>
    pub fn operations(&self) -> ::std::option::Option<&[crate::types::KmsGrantOperation]> {
        self.operations.as_deref()
    }
    /// <p>The principal that is given permission to perform the operations that the grant permits.</p>
    pub fn grantee_principal(&self) -> ::std::option::Option<&str> {
        self.grantee_principal.as_deref()
    }
    /// <p>The principal that is given permission to retire the grant by using <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_RetireGrant.html">RetireGrant</a> operation.</p>
    pub fn retiring_principal(&self) -> ::std::option::Option<&str> {
        self.retiring_principal.as_deref()
    }
    /// <p>Use this structure to propose allowing <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> in the grant only when the operation request includes the specified <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">encryption context</a>.</p>
    pub fn constraints(&self) -> ::std::option::Option<&crate::types::KmsGrantConstraints> {
        self.constraints.as_ref()
    }
    /// <p> The Amazon Web Services account under which the grant was issued. The account is used to propose KMS grants issued by accounts other than the owner of the key.</p>
    pub fn issuing_account(&self) -> ::std::option::Option<&str> {
        self.issuing_account.as_deref()
    }
}
impl KmsGrantConfiguration {
    /// Creates a new builder-style object to manufacture [`KmsGrantConfiguration`](crate::types::KmsGrantConfiguration).
    pub fn builder() -> crate::types::builders::KmsGrantConfigurationBuilder {
        crate::types::builders::KmsGrantConfigurationBuilder::default()
    }
}

/// A builder for [`KmsGrantConfiguration`](crate::types::KmsGrantConfiguration).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct KmsGrantConfigurationBuilder {
    pub(crate) operations: ::std::option::Option<::std::vec::Vec<crate::types::KmsGrantOperation>>,
    pub(crate) grantee_principal: ::std::option::Option<::std::string::String>,
    pub(crate) retiring_principal: ::std::option::Option<::std::string::String>,
    pub(crate) constraints: ::std::option::Option<crate::types::KmsGrantConstraints>,
    pub(crate) issuing_account: ::std::option::Option<::std::string::String>,
}
impl KmsGrantConfigurationBuilder {
    /// Appends an item to `operations`.
    ///
    /// To override the contents of this collection use [`set_operations`](Self::set_operations).
    ///
    /// <p>A list of operations that the grant permits.</p>
    pub fn operations(mut self, input: crate::types::KmsGrantOperation) -> Self {
        let mut v = self.operations.unwrap_or_default();
        v.push(input);
        self.operations = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of operations that the grant permits.</p>
    pub fn set_operations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::KmsGrantOperation>>) -> Self {
        self.operations = input;
        self
    }
    /// <p>A list of operations that the grant permits.</p>
    pub fn get_operations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::KmsGrantOperation>> {
        &self.operations
    }
    /// <p>The principal that is given permission to perform the operations that the grant permits.</p>
    pub fn grantee_principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.grantee_principal = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The principal that is given permission to perform the operations that the grant permits.</p>
    pub fn set_grantee_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.grantee_principal = input;
        self
    }
    /// <p>The principal that is given permission to perform the operations that the grant permits.</p>
    pub fn get_grantee_principal(&self) -> &::std::option::Option<::std::string::String> {
        &self.grantee_principal
    }
    /// <p>The principal that is given permission to retire the grant by using <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_RetireGrant.html">RetireGrant</a> operation.</p>
    pub fn retiring_principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.retiring_principal = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The principal that is given permission to retire the grant by using <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_RetireGrant.html">RetireGrant</a> operation.</p>
    pub fn set_retiring_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.retiring_principal = input;
        self
    }
    /// <p>The principal that is given permission to retire the grant by using <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_RetireGrant.html">RetireGrant</a> operation.</p>
    pub fn get_retiring_principal(&self) -> &::std::option::Option<::std::string::String> {
        &self.retiring_principal
    }
    /// <p>Use this structure to propose allowing <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> in the grant only when the operation request includes the specified <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">encryption context</a>.</p>
    pub fn constraints(mut self, input: crate::types::KmsGrantConstraints) -> Self {
        self.constraints = ::std::option::Option::Some(input);
        self
    }
    /// <p>Use this structure to propose allowing <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> in the grant only when the operation request includes the specified <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">encryption context</a>.</p>
    pub fn set_constraints(mut self, input: ::std::option::Option<crate::types::KmsGrantConstraints>) -> Self {
        self.constraints = input;
        self
    }
    /// <p>Use this structure to propose allowing <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> in the grant only when the operation request includes the specified <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">encryption context</a>.</p>
    pub fn get_constraints(&self) -> &::std::option::Option<crate::types::KmsGrantConstraints> {
        &self.constraints
    }
    /// <p> The Amazon Web Services account under which the grant was issued. The account is used to propose KMS grants issued by accounts other than the owner of the key.</p>
    pub fn issuing_account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.issuing_account = ::std::option::Option::Some(input.into());
        self
    }
    /// <p> The Amazon Web Services account under which the grant was issued. The account is used to propose KMS grants issued by accounts other than the owner of the key.</p>
    pub fn set_issuing_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.issuing_account = input;
        self
    }
    /// <p> The Amazon Web Services account under which the grant was issued. The account is used to propose KMS grants issued by accounts other than the owner of the key.</p>
    pub fn get_issuing_account(&self) -> &::std::option::Option<::std::string::String> {
        &self.issuing_account
    }
    /// Consumes the builder and constructs a [`KmsGrantConfiguration`](crate::types::KmsGrantConfiguration).
    pub fn build(self) -> crate::types::KmsGrantConfiguration {
        crate::types::KmsGrantConfiguration {
            operations: self.operations,
            grantee_principal: self.grantee_principal,
            retiring_principal: self.retiring_principal,
            constraints: self.constraints,
            issuing_account: self.issuing_account,
        }
    }
}