-
Notifications
You must be signed in to change notification settings - Fork 9
/
partition.go
32 lines (27 loc) · 1.11 KB
/
partition.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
package metal
// A Partition represents a location.
type Partition struct {
Base
BootConfiguration BootConfiguration `rethinkdb:"bootconfig" json:"bootconfig"`
MgmtServiceAddress string `rethinkdb:"mgmtserviceaddr" json:"mgmtserviceaddr"`
PrivateNetworkPrefixLength uint8 `rethinkdb:"privatenetworkprefixlength" json:"privatenetworkprefixlength"`
Labels map[string]string `rethinkdb:"labels" json:"labels"`
}
// BootConfiguration defines the metal-hammer initrd, kernel and commandline
type BootConfiguration struct {
ImageURL string `rethinkdb:"imageurl" json:"imageurl"`
KernelURL string `rethinkdb:"kernelurl" json:"kernelurl"`
CommandLine string `rethinkdb:"commandline" json:"commandline"`
}
// Partitions is a list of partitions.
type Partitions []Partition
// PartitionMap is an indexed map of partitions
type PartitionMap map[string]Partition
// ByID creates an indexed map of partitions where the id is the index.
func (sz Partitions) ByID() PartitionMap {
res := make(PartitionMap)
for i, s := range sz {
res[s.ID] = sz[i]
}
return res
}