File: network_peer.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 (105 lines) | stat: -rw-r--r-- 2,906 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
package api

// NetworkPeersPost represents the fields of a new network peering
//
// swagger:model
//
// API extension: network_peer.
type NetworkPeersPost struct {
	NetworkPeerPut `yaml:",inline"`

	// Name of the peer
	// Example: project1-network1
	Name string `json:"name" yaml:"name"`

	// Name of the target project
	// Example: project1
	TargetProject string `json:"target_project,omitempty" yaml:"target_project,omitempty"`

	// Name of the target network
	// Example: network1
	TargetNetwork string `json:"target_network,omitempty" yaml:"target_network,omitempty"`

	// Type of peer
	// Example: local
	//
	// API extension: network_integrations.
	Type string `json:"type" yaml:"type"`

	// Name of the target integration
	// Example: ovn-ic1
	//
	// API extension: network_integrations.
	TargetIntegration string `json:"target_integration,omitempty" yaml:"target_integration,omitempty"`
}

// NetworkPeerPut represents the modifiable fields of a network peering
//
// swagger:model
//
// API extension: network_peer.
type NetworkPeerPut struct {
	// Description of the peer
	// Example: Peering with network1 in project1
	Description string `json:"description" yaml:"description"`

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

// NetworkPeer used for displaying a network peering.
//
// swagger:model
//
// API extension: network_forward.
type NetworkPeer struct {
	NetworkPeerPut `yaml:",inline"`

	// Name of the peer
	// Read only: true
	// Example: project1-network1
	Name string `json:"name" yaml:"name"`

	// Name of the target project
	// Read only: true
	// Example: project1
	TargetProject string `json:"target_project,omitempty" yaml:"target_project,omitempty"`

	// Name of the target network
	// Read only: true
	// Example: network1
	TargetNetwork string `json:"target_network,omitempty" yaml:"target_network,omitempty"`

	// The state of the peering
	// Read only: true
	// Example: Pending
	Status string `json:"status" yaml:"status"`

	// List of URLs of objects using this network peering
	// Read only: true
	// Example: ["/1.0/network-acls/test", "/1.0/network-acls/foo"]
	UsedBy []string `json:"used_by" yaml:"used_by"`

	// Type of peer
	// Example: local
	//
	// API extension: network_integrations.
	Type string `json:"type" yaml:"type"`

	// Name of the target integration
	// Example: ovn-ic1
	//
	// API extension: network_integrations.
	TargetIntegration string `json:"target_integration,omitempty" yaml:"target_integration,omitempty"`
}

// Etag returns the values used for etag generation.
func (p *NetworkPeer) Etag() []any {
	return []any{p.Name, p.Description, p.Config}
}

// Writable converts a full NetworkPeer struct into a NetworkPeerPut struct (filters read-only fields).
func (p *NetworkPeer) Writable() NetworkPeerPut {
	return p.NetworkPeerPut
}