File: network_zone.go

package info (click to toggle)
incus 6.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 23,864 kB
  • sloc: sh: 16,015; ansic: 3,121; python: 456; makefile: 321; ruby: 51; sql: 50; lisp: 6
file content (126 lines) | stat: -rw-r--r-- 3,296 bytes parent folder | download | duplicates (6)
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
package api

// NetworkZonesPost represents the fields of a new network zone
//
// swagger:model
//
// API extension: network_dns.
type NetworkZonesPost struct {
	NetworkZonePut `yaml:",inline"`

	// The name of the zone (DNS domain name)
	// Example: example.net
	Name string `json:"name" yaml:"name"`
}

// NetworkZonePut represents the modifiable fields of a network zone
//
// swagger:model
//
// API extension: network_dns.
type NetworkZonePut struct {
	// Description of the network zone
	// Example: Internal domain
	Description string `json:"description" yaml:"description"`

	// Zone configuration map (refer to doc/network-zones.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`
}

// NetworkZone represents a network zone (DNS).
//
// swagger:model
//
// API extension: network_dns.
type NetworkZone struct {
	NetworkZonePut `yaml:",inline"`

	// The name of the zone (DNS domain name)
	// Example: example.net
	Name string `json:"name" yaml:"name"`

	// List of URLs of objects using this network zone
	// Read only: true
	// Example: ["/1.0/networks/foo", "/1.0/networks/bar"]
	UsedBy []string `json:"used_by" yaml:"used_by"` // Resources that use the zone.

	// Project name
	// Example: project1
	//
	// API extension: network_zones_all_projects
	Project string `json:"project" yaml:"project"`
}

// Writable converts a full NetworkZone struct into a NetworkZonePut struct (filters read-only fields).
func (f *NetworkZone) Writable() NetworkZonePut {
	return f.NetworkZonePut
}

// NetworkZoneRecordsPost represents the fields of a new network zone record
//
// swagger:model
//
// API extension: network_dns_records.
type NetworkZoneRecordsPost struct {
	NetworkZoneRecordPut `yaml:",inline"`

	// The record name in the zone
	// Example: @
	Name string `json:"name" yaml:"name"`
}

// NetworkZoneRecordPut represents the modifiable fields of a network zone record
//
// swagger:model
//
// API extension: network_dns_records.
type NetworkZoneRecordPut struct {
	// Description of the record
	// Example: SPF record
	Description string `json:"description" yaml:"description"`

	// Entries in the record
	Entries []NetworkZoneRecordEntry `json:"entries" yaml:"entries"`

	// Advanced configuration for the record
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`
}

// NetworkZoneRecordEntry represents the fields in a record entry
//
// swagger:model
//
// API extension: network_dns_records.
type NetworkZoneRecordEntry struct {
	// Type of DNS entry
	// Example: TXT
	Type string `json:"type" yaml:"type"`

	// TTL for the entry
	// Example: 3600
	TTL uint64 `json:"ttl,omitempty" yaml:"ttl,omitempty"`

	// Value for the record
	// Example: v=spf1 mx ~all
	Value string `json:"value" yaml:"value"`
}

// NetworkZoneRecord represents a network zone (DNS) record.
//
// swagger:model
//
// API extension: network_dns_records.
type NetworkZoneRecord struct {
	NetworkZoneRecordPut `yaml:",inline"`

	// The name of the record
	// Example: @
	Name string `json:"name" yaml:"name"`
}

// Writable converts a full NetworkZoneRecord struct into a NetworkZoneRecordPut struct (filters read-only fields).
func (f *NetworkZoneRecord) Writable() NetworkZoneRecordPut {
	return f.NetworkZoneRecordPut
}