/
types.go
59 lines (46 loc) · 1.02 KB
/
types.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
// Copyright 2018 NetApp, Inc. All Rights Reserved.
package storageattribute
type Offer interface {
Matches(requested Request) bool
ToString() string
}
// At the moment, there aren't any terribly useful methods to put here, but
// there might be. This is more here for symmetry at the moment.
type Request interface {
GetType() Type
Value() interface{}
String() string
}
type Type string
const (
intType Type = "int"
boolType Type = "bool"
stringType Type = "string"
labelType Type = "label"
)
type intOffer struct {
Min int `json:"min"`
Max int `json:"max"`
}
type intRequest struct {
Request int `json:"request"`
}
type boolOffer struct {
Offer bool `json:"offer"`
}
type boolRequest struct {
Request bool `json:"request"`
}
type stringOffer struct {
Offers []string `json:"offer"`
}
type stringRequest struct {
Request string `json:"request"`
}
type labelOffer struct {
Offers map[string]string `json:"offer"`
}
type labelRequest struct {
Request string `json:"request"`
selectors []labelSelector
}