-
Notifications
You must be signed in to change notification settings - Fork 0
/
results.go
40 lines (31 loc) · 938 Bytes
/
results.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
package quotas
import edgecloud "github.com/Edge-Center/edgecentercloud-go"
type Quota map[string]int
type CombinedQuota struct {
GlobalQuotas Quota `json:"global_quotas"`
RegionalQuotas []Quota `json:"regional_quotas"`
}
type CommonResult struct {
edgecloud.Result
}
// Extract is a function that accepts a result and extracts a quotas resource.
func (r CommonResult) Extract() (*Quota, error) {
var s Quota
err := r.ExtractInto(&s)
return &s, err
}
func (r CommonResult) ExtractInto(v interface{}) error {
return r.Result.ExtractIntoMapPtr(v, "")
}
type CombinedResult struct {
edgecloud.Result
}
// Extract is a function that accepts a result and extracts a combined quota resource.
func (r CombinedResult) Extract() (*CombinedQuota, error) {
var s CombinedQuota
err := r.ExtractInto(&s)
return &s, err
}
func (r CombinedResult) ExtractInto(v interface{}) error {
return r.Result.ExtractIntoStructPtr(v, "")
}