hcloud/models/create_zone_request.rs
1/*
2 * Hetzner Cloud API
3 *
4 * Copied from the official API documentation for the Public Hetzner Cloud.
5 *
6 * The version of the OpenAPI document: 4b3f595
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// CreateZoneRequest : Request for POST https://api.hetzner.cloud/v1/zones
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CreateZoneRequest {
17 /// User-defined labels (`key/value` pairs) for the Resource. For more information, see \"Labels\". | User-defined labels (`key/value` pairs) for the Resource. Note that the set of Labels provided in the request will overwrite the existing one. For more information, see \"Labels\".
18 #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
19 pub labels: Option<std::collections::HashMap<String, String>>,
20 /// Mode of the Zone. For more information, see Zone Modes.
21 #[serde(rename = "mode")]
22 pub mode: Mode,
23 /// Name of the Zone. All names with [well-known public suffixes](https://publicsuffix.org/) (e.g. `.de`, `.com`, `.co.uk`) are supported. Subdomains are not supported. The name must be in lower case and must not end with a dot. [Internationalized domain names](https://en.wikipedia.org/wiki/Internationalized_domain_name) must be transcribed to [Punycode](https://wikipedia.org/wiki/Punycode) representation with ACE prefix, e.g. `xn--mnchen-3ya.de` (`münchen.de`).
24 #[serde(rename = "name")]
25 pub name: String,
26 /// Primary nameservers of the Zone. Only applicable for Zones in secondary mode. Ignored for Zones in primary mode.
27 #[serde(
28 rename = "primary_nameservers",
29 skip_serializing_if = "Option::is_none"
30 )]
31 pub primary_nameservers: Option<Vec<models::Nameserver>>,
32 /// RRSets to be added to the Zone. Only applicable for Zones in primary mode. Ignored for Zones in secondary mode.
33 #[serde(rename = "rrsets", skip_serializing_if = "Option::is_none")]
34 pub rrsets: Option<Vec<models::ResourceRecordSetToCreate>>,
35 /// Default Time To Live (TTL) of the Zone. Must be in between 60s and 2147483647s. This TTL is used for RRSets that do not explicitly define a TTL.
36 #[serde(rename = "ttl", skip_serializing_if = "Option::is_none")]
37 pub ttl: Option<i32>,
38 /// Zone file to import. Only applicable for Zones in primary mode. Ignored for Zones in secondary mode. If provided, `rrsets` must be empty. See Zone file import for more details.
39 #[serde(rename = "zonefile", skip_serializing_if = "Option::is_none")]
40 pub zonefile: Option<String>,
41}
42
43impl CreateZoneRequest {
44 /// Request for POST https://api.hetzner.cloud/v1/zones
45 pub fn new(mode: Mode, name: String) -> CreateZoneRequest {
46 CreateZoneRequest {
47 labels: None,
48 mode,
49 name,
50 primary_nameservers: None,
51 rrsets: None,
52 ttl: None,
53 zonefile: None,
54 }
55 }
56}
57/// Mode of the Zone. For more information, see Zone Modes.
58#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
59pub enum Mode {
60 #[serde(rename = "primary")]
61 Primary,
62 #[serde(rename = "secondary")]
63 Secondary,
64}
65
66impl Default for Mode {
67 fn default() -> Mode {
68 Self::Primary
69 }
70}