Skip to main content

oci_rust_sdk/core/models/
create_macsec_properties.rs

1use serde::{Deserialize, Serialize};
2
3#[allow(unused_imports)]
4use super::*;
5/// Properties used to configure MACsec (if capable).
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct CreateMacsecProperties {
9    /// Indicates whether or not MACsec is enabled.
10    pub state: MacsecState,
11
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub primary_key: Option<CreateMacsecKey>,
14
15    /// Type of encryption cipher suite to use for the MACsec connection.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub encryption_cipher: Option<MacsecEncryptionCipher>,
18
19    /// Indicates whether unencrypted traffic is allowed if MACsec Key Agreement protocol (MKA) fails.
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub is_unprotected_traffic_allowed: Option<bool>,
22}
23
24/// Required fields for CreateMacsecProperties
25pub struct CreateMacsecPropertiesRequired {
26    /// Indicates whether or not MACsec is enabled.
27    pub state: MacsecState,
28}
29
30impl CreateMacsecProperties {
31    /// Create a new CreateMacsecProperties with required fields
32    pub fn new(required: CreateMacsecPropertiesRequired) -> Self {
33        Self {
34            state: required.state,
35
36            primary_key: None,
37
38            encryption_cipher: None,
39
40            is_unprotected_traffic_allowed: None,
41        }
42    }
43
44    /// Set state
45    pub fn set_state(mut self, value: MacsecState) -> Self {
46        self.state = value;
47        self
48    }
49
50    /// Set primary_key
51    pub fn set_primary_key(mut self, value: Option<CreateMacsecKey>) -> Self {
52        self.primary_key = value;
53        self
54    }
55
56    /// Set encryption_cipher
57    pub fn set_encryption_cipher(mut self, value: Option<MacsecEncryptionCipher>) -> Self {
58        self.encryption_cipher = value;
59        self
60    }
61
62    /// Set is_unprotected_traffic_allowed
63    pub fn set_is_unprotected_traffic_allowed(mut self, value: Option<bool>) -> Self {
64        self.is_unprotected_traffic_allowed = value;
65        self
66    }
67
68    /// Set primary_key (unwraps Option)
69    pub fn with_primary_key(mut self, value: CreateMacsecKey) -> Self {
70        self.primary_key = Some(value);
71        self
72    }
73
74    /// Set encryption_cipher (unwraps Option)
75    pub fn with_encryption_cipher(mut self, value: MacsecEncryptionCipher) -> Self {
76        self.encryption_cipher = Some(value);
77        self
78    }
79
80    /// Set is_unprotected_traffic_allowed (unwraps Option)
81    pub fn with_is_unprotected_traffic_allowed(mut self, value: bool) -> Self {
82        self.is_unprotected_traffic_allowed = Some(value);
83        self
84    }
85}