This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
results.go
60 lines (50 loc) · 1.51 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package cloudservers
import (
"github.com/gophercloud/gophercloud"
)
// ActionResult represents the result of server action operations, like reboot.
// Call its ExtractErr method to determine if the action succeeded or failed.
type ActionResult struct {
gophercloud.ErrResult
}
type ChangeResult struct {
gophercloud.Result
}
type Job struct {
ID string `json:"job_id"`
}
func (r ChangeResult) ExtractJob() (*Job, error) {
var j *Job
err := r.ExtractInto(&j)
return j, err
}
type FlavorResult struct {
gophercloud.Result
}
type Flavor struct {
Name string `json:"name"`
Links []Link `json:"links"`
RAM int `json:"ram"`
OSFLVDISABLEDDisabled bool `json:"OS-FLV-DISABLED:disabled"`
Vcpus int `json:"vcpus"`
ExtraSpecs ExtraSpecs `json:"extra_specs"`
Swap string `json:"swap"`
OsFlavorAccessIsPublic bool `json:"os-flavor-access:is_public"`
RxtxFactor float64 `json:"rxtx_factor"`
OSFLVEXTDATAEphemeral int `json:"OS-FLV-EXT-DATA:ephemeral"`
Disk int `json:"disk"`
ID string `json:"id"`
}
type Link struct {
Href string `json:"href"`
Rel string `json:"rel"`
}
type ExtraSpecs struct {
EcsPerformancetype string `json:"ecs:performancetype"`
ResourceType string `json:"resource_type"`
}
func (r FlavorResult) Extract() (*[]Flavor, error) {
var f *[]Flavor
err := r.ExtractInto(&f)
return f, err
}