This repository was archived by the owner on Sep 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathreservation.go
119 lines (105 loc) · 2.85 KB
/
reservation.go
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
package models
import "net"
// Reservation tracks persistent DHCP IP address reservations.
//
// swagger:model
type Reservation struct {
Validation
Access
Meta
Owned
Bundled
// Addr is the IP address permanently assigned to the strategy/token combination.
//
// required: true
// swagger:strfmt ipv4
Addr net.IP `index:",key"`
// A description of this Reservation. This should tell what it is for,
// any special considerations that should be taken into account when
// using it, etc.
Description string
// Documentation of this reservation. This should tell what
// the reservation is for, any special considerations that
// should be taken into account when using it, etc. in rich structured text (rst).
Documentation string
// Token is the unique identifier that the strategy for this Reservation should use.
//
// required: true
Token string
// Subnet is the name of the Subnet that this Reservation is associated with.
// This property is read-only.
//
Subnet string
// NextServer is the address the server should contact next. You
// should only set this if you want to talk to a DHCP or TFTP server
// other than the one provided by dr-provision.
//
// required: false
// swagger:strfmt ipv4
NextServer net.IP
// Options is the list of DHCP options that apply to this Reservation
Options []DhcpOption
// Strategy is the leasing strategy that will be used determine what to use from
// the DHCP packet to handle lease management.
//
// required: true
Strategy string
// Scoped indicates that this reservation is tied to a particular Subnet,
// as determined by the reservation's Addr.
//
// required: true
Scoped bool
// Duration is the time in seconds for which a lease can be valid.
// ExpireTime is calculated from Duration.
Duration int32
}
func (r *Reservation) GetMeta() Meta {
return r.Meta
}
func (r *Reservation) SetMeta(d Meta) {
r.Meta = d
}
// GetDocumentation returns the object's documentation
func (r *Reservation) GetDocumentation() string {
return r.Documentation
}
// GetDescription returns the object's description
func (r *Reservation) GetDescription() string {
return r.Description
}
func (r *Reservation) Prefix() string {
return "reservations"
}
func (r *Reservation) Key() string {
return Hexaddr(r.Addr)
}
func (r *Reservation) KeyName() string {
return "Addr"
}
func (r *Reservation) Fill() {
r.Validation.fill(r)
if r.Meta == nil {
r.Meta = Meta{}
}
if r.Options == nil {
r.Options = []DhcpOption{}
}
}
func (r *Reservation) AuthKey() string {
return r.Key()
}
func (r *Reservation) SliceOf() interface{} {
s := []*Reservation{}
return &s
}
func (r *Reservation) ToModels(obj interface{}) []Model {
items := obj.(*[]*Reservation)
res := make([]Model, len(*items))
for i, item := range *items {
res[i] = Model(item)
}
return res
}
func (r *Reservation) CanHaveActions() bool {
return true
}