-
Notifications
You must be signed in to change notification settings - Fork 7
/
results.go
73 lines (61 loc) · 1.59 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
61
62
63
64
65
66
67
68
69
70
71
72
73
package namespaces
import (
"github.com/huaweicloud/terraform-provider-hcs/huaweicloudstack/sdk/huaweicloud"
)
type Namespace struct {
// Name of the Namespace
Name string `json:"name"`
// Creator Name of the Namespace
CreatorName string `json:"creator_name"`
// Auth permission of the Namespace
Auth int `json:"auth"`
}
type commonResult struct {
golangsdk.Result
}
// Extract is a function that accepts a result and extracts a namespace.
func (r commonResult) Extract() (*Namespace, error) {
var s Namespace
err := r.ExtractInto(&s)
return &s, err
}
// CreateResult represents the result of a create operation.
type CreateResult struct {
golangsdk.ErrResult
}
// GetResult represents the result of a get operation. Call its Extract
// method to interpret it as a Network.
type GetResult struct {
commonResult
}
// DeleteResult represents the result of a delete operation. Call its ExtractErr
// method to determine if the request succeeded or failed.
type DeleteResult struct {
golangsdk.ErrResult
}
type Access struct {
// ID of the access
ID int `json:"id"`
// Name of the Namespace
Name string `json:"name"`
// Creator Name of the Namespace
CreatorName string `json:"creator_name"`
// Permission of current user
SelfAuth User `json:"self_auth"`
// Permission of other users
OthersAuths []User `json:"others_auths"`
}
type CreateAccessResult struct {
golangsdk.ErrResult
}
type GetAccessResult struct {
commonResult
}
type DeleteAccessResult struct {
golangsdk.ErrResult
}
func (r GetAccessResult) Extract() (*Access, error) {
var s Access
err := r.ExtractInto(&s)
return &s, err
}