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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Defines the attributes of the private key.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct PrivateKeyAttributesV4 {
    /// <p>Set the minimum key length of the private key.</p>
    pub minimal_key_length: i32,
    /// <p>Defines the purpose of the private key. Set it to "KEY_EXCHANGE" or "SIGNATURE" value.</p>
    pub key_spec: crate::types::KeySpec,
    /// <p>Defines the cryptographic providers used to generate the private key.</p>
    pub crypto_providers: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>The key usage property defines the purpose of the private key contained in the certificate. You can specify specific purposes using property flags or all by using property type ALL.</p>
    pub key_usage_property: ::std::option::Option<crate::types::KeyUsageProperty>,
    /// <p>Defines the algorithm used to generate the private key.</p>
    pub algorithm: ::std::option::Option<crate::types::PrivateKeyAlgorithm>,
}
impl PrivateKeyAttributesV4 {
    /// <p>Set the minimum key length of the private key.</p>
    pub fn minimal_key_length(&self) -> i32 {
        self.minimal_key_length
    }
    /// <p>Defines the purpose of the private key. Set it to "KEY_EXCHANGE" or "SIGNATURE" value.</p>
    pub fn key_spec(&self) -> &crate::types::KeySpec {
        &self.key_spec
    }
    /// <p>Defines the cryptographic providers used to generate the private key.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.crypto_providers.is_none()`.
    pub fn crypto_providers(&self) -> &[::std::string::String] {
        self.crypto_providers.as_deref().unwrap_or_default()
    }
    /// <p>The key usage property defines the purpose of the private key contained in the certificate. You can specify specific purposes using property flags or all by using property type ALL.</p>
    pub fn key_usage_property(&self) -> ::std::option::Option<&crate::types::KeyUsageProperty> {
        self.key_usage_property.as_ref()
    }
    /// <p>Defines the algorithm used to generate the private key.</p>
    pub fn algorithm(&self) -> ::std::option::Option<&crate::types::PrivateKeyAlgorithm> {
        self.algorithm.as_ref()
    }
}
impl PrivateKeyAttributesV4 {
    /// Creates a new builder-style object to manufacture [`PrivateKeyAttributesV4`](crate::types::PrivateKeyAttributesV4).
    pub fn builder() -> crate::types::builders::PrivateKeyAttributesV4Builder {
        crate::types::builders::PrivateKeyAttributesV4Builder::default()
    }
}

/// A builder for [`PrivateKeyAttributesV4`](crate::types::PrivateKeyAttributesV4).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PrivateKeyAttributesV4Builder {
    pub(crate) minimal_key_length: ::std::option::Option<i32>,
    pub(crate) key_spec: ::std::option::Option<crate::types::KeySpec>,
    pub(crate) crypto_providers: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) key_usage_property: ::std::option::Option<crate::types::KeyUsageProperty>,
    pub(crate) algorithm: ::std::option::Option<crate::types::PrivateKeyAlgorithm>,
}
impl PrivateKeyAttributesV4Builder {
    /// <p>Set the minimum key length of the private key.</p>
    /// This field is required.
    pub fn minimal_key_length(mut self, input: i32) -> Self {
        self.minimal_key_length = ::std::option::Option::Some(input);
        self
    }
    /// <p>Set the minimum key length of the private key.</p>
    pub fn set_minimal_key_length(mut self, input: ::std::option::Option<i32>) -> Self {
        self.minimal_key_length = input;
        self
    }
    /// <p>Set the minimum key length of the private key.</p>
    pub fn get_minimal_key_length(&self) -> &::std::option::Option<i32> {
        &self.minimal_key_length
    }
    /// <p>Defines the purpose of the private key. Set it to "KEY_EXCHANGE" or "SIGNATURE" value.</p>
    /// This field is required.
    pub fn key_spec(mut self, input: crate::types::KeySpec) -> Self {
        self.key_spec = ::std::option::Option::Some(input);
        self
    }
    /// <p>Defines the purpose of the private key. Set it to "KEY_EXCHANGE" or "SIGNATURE" value.</p>
    pub fn set_key_spec(mut self, input: ::std::option::Option<crate::types::KeySpec>) -> Self {
        self.key_spec = input;
        self
    }
    /// <p>Defines the purpose of the private key. Set it to "KEY_EXCHANGE" or "SIGNATURE" value.</p>
    pub fn get_key_spec(&self) -> &::std::option::Option<crate::types::KeySpec> {
        &self.key_spec
    }
    /// Appends an item to `crypto_providers`.
    ///
    /// To override the contents of this collection use [`set_crypto_providers`](Self::set_crypto_providers).
    ///
    /// <p>Defines the cryptographic providers used to generate the private key.</p>
    pub fn crypto_providers(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.crypto_providers.unwrap_or_default();
        v.push(input.into());
        self.crypto_providers = ::std::option::Option::Some(v);
        self
    }
    /// <p>Defines the cryptographic providers used to generate the private key.</p>
    pub fn set_crypto_providers(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.crypto_providers = input;
        self
    }
    /// <p>Defines the cryptographic providers used to generate the private key.</p>
    pub fn get_crypto_providers(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.crypto_providers
    }
    /// <p>The key usage property defines the purpose of the private key contained in the certificate. You can specify specific purposes using property flags or all by using property type ALL.</p>
    pub fn key_usage_property(mut self, input: crate::types::KeyUsageProperty) -> Self {
        self.key_usage_property = ::std::option::Option::Some(input);
        self
    }
    /// <p>The key usage property defines the purpose of the private key contained in the certificate. You can specify specific purposes using property flags or all by using property type ALL.</p>
    pub fn set_key_usage_property(mut self, input: ::std::option::Option<crate::types::KeyUsageProperty>) -> Self {
        self.key_usage_property = input;
        self
    }
    /// <p>The key usage property defines the purpose of the private key contained in the certificate. You can specify specific purposes using property flags or all by using property type ALL.</p>
    pub fn get_key_usage_property(&self) -> &::std::option::Option<crate::types::KeyUsageProperty> {
        &self.key_usage_property
    }
    /// <p>Defines the algorithm used to generate the private key.</p>
    pub fn algorithm(mut self, input: crate::types::PrivateKeyAlgorithm) -> Self {
        self.algorithm = ::std::option::Option::Some(input);
        self
    }
    /// <p>Defines the algorithm used to generate the private key.</p>
    pub fn set_algorithm(mut self, input: ::std::option::Option<crate::types::PrivateKeyAlgorithm>) -> Self {
        self.algorithm = input;
        self
    }
    /// <p>Defines the algorithm used to generate the private key.</p>
    pub fn get_algorithm(&self) -> &::std::option::Option<crate::types::PrivateKeyAlgorithm> {
        &self.algorithm
    }
    /// Consumes the builder and constructs a [`PrivateKeyAttributesV4`](crate::types::PrivateKeyAttributesV4).
    /// This method will fail if any of the following fields are not set:
    /// - [`minimal_key_length`](crate::types::builders::PrivateKeyAttributesV4Builder::minimal_key_length)
    /// - [`key_spec`](crate::types::builders::PrivateKeyAttributesV4Builder::key_spec)
    pub fn build(self) -> ::std::result::Result<crate::types::PrivateKeyAttributesV4, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::PrivateKeyAttributesV4 {
            minimal_key_length: self.minimal_key_length.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "minimal_key_length",
                    "minimal_key_length was not specified but it is required when building PrivateKeyAttributesV4",
                )
            })?,
            key_spec: self.key_spec.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "key_spec",
                    "key_spec was not specified but it is required when building PrivateKeyAttributesV4",
                )
            })?,
            crypto_providers: self.crypto_providers,
            key_usage_property: self.key_usage_property,
            algorithm: self.algorithm,
        })
    }
}