nethsm_sdk_rs/models/
distinguished_name.rs

1/*
2 * NetHSM
3 *
4 * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian.
5 *
6 * The version of the OpenAPI document: v1
7 * Contact: Nitrokey <info@nitrokey.com>
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// DistinguishedName : Data used for creation of CSRs. If subjectAltNames is omitted, it is set to the same value as commonName. If it is set to an empty list, no SAN Extension is added.
12
13#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
14#[non_exhaustive]
15pub struct DistinguishedName {
16    #[serde(rename = "countryName", skip_serializing_if = "Option::is_none")]
17    pub country_name: Option<String>,
18    #[serde(
19        rename = "stateOrProvinceName",
20        skip_serializing_if = "Option::is_none"
21    )]
22    pub state_or_province_name: Option<String>,
23    #[serde(rename = "localityName", skip_serializing_if = "Option::is_none")]
24    pub locality_name: Option<String>,
25    #[serde(rename = "organizationName", skip_serializing_if = "Option::is_none")]
26    pub organization_name: Option<String>,
27    #[serde(
28        rename = "organizationalUnitName",
29        skip_serializing_if = "Option::is_none"
30    )]
31    pub organizational_unit_name: Option<String>,
32    #[serde(rename = "commonName")]
33    pub common_name: String,
34    #[serde(rename = "emailAddress", skip_serializing_if = "Option::is_none")]
35    pub email_address: Option<String>,
36    #[serde(rename = "subjectAltNames", skip_serializing_if = "Option::is_none")]
37    pub subject_alt_names: Option<Vec<String>>,
38}
39
40impl DistinguishedName {
41    /// Data used for creation of CSRs. If subjectAltNames is omitted, it is set to the same value as commonName. If it is set to an empty list, no SAN Extension is added.
42    pub fn new(common_name: String) -> DistinguishedName {
43        DistinguishedName {
44            country_name: None,
45            state_or_province_name: None,
46            locality_name: None,
47            organization_name: None,
48            organizational_unit_name: None,
49            common_name,
50            email_address: None,
51            subject_alt_names: None,
52        }
53    }
54}