clientapi_pve/models/pve_replication_config.rs
1/*
2 * Proxmox Virtual Environment API
3 *
4 * Generated from apidoc.js. NOT an official Proxmox specification. See https://pve.proxmox.com/pve-docs/api-viewer/ for the upstream documentation.
5 *
6 * The version of the OpenAPI document: 9.x
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct PveReplicationConfig {
16
17 /// CIDR of the (sub) network that is used for replication jobs.
18 #[serde(rename = "network", skip_serializing_if = "Option::is_none")]
19 pub network: Option<String>,
20
21 /// Replication traffic is encrypted using an SSH tunnel by default. On secure, completely private networks this can be disabled to increase performance.
22 #[serde(rename = "type")]
23 pub r#type: models::PveMigrationTypeEnum,
24
25
26}
27
28impl PveReplicationConfig {
29 pub fn new(r#type: models::PveMigrationTypeEnum) -> PveReplicationConfig {
30 PveReplicationConfig {
31
32 network: None,
33
34 r#type,
35
36 }
37 }
38}
39
40
41impl PveReplicationConfig {
42 /// Serialise this PveReplicationConfig into Proxmox's CLI-style shorthand
43 /// string (`key=value,…`). The property marked `x-pve-default-key`
44 /// is emitted positionally without a `key=` prefix; aliases collapse
45 /// multiple property names to the same wire key.
46 ///
47 /// Example: `PveReplicationConfig `
48 /// → `"virtio,bridge=vmbr0"`
49 pub fn to_shorthand(&self) -> String {
50 let mut parts: Vec<String> = Vec::new();
51
52
53 parts.push(format!("{}", self.r#type));
54
55
56
57
58 if let Some(ref v) = self.network {
59 parts.push(format!("network={}", v));
60 }
61
62 parts.join(",")
63 }
64}
65