-
Notifications
You must be signed in to change notification settings - Fork 6
/
results.go
58 lines (47 loc) · 1.54 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
package groups
import (
"github.com/huaweicloud/terraform-provider-hcs/huaweicloudstack/sdk/huaweicloud"
"github.com/huaweicloud/terraform-provider-hcs/huaweicloudstack/sdk/huaweicloud/openstack/iec/v1/common"
)
type commonResult struct {
golangsdk.Result
}
//RespSecurityGroupEntity 获取安全组信息时候,返回结构体
type RespSecurityGroupEntity struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
SecurityGroupRules []common.RespSecurityGroupRuleEntity `json:"security_group_rules"`
}
type CreateResult struct {
commonResult
}
func (r CreateResult) Extract() (*RespSecurityGroupEntity, error) {
var entity RespSecurityGroupEntity
err := r.ExtractIntoStructPtr(&entity, "security_group")
return &entity, err
}
type DeleteResult struct {
golangsdk.ErrResult
}
type GetResult struct {
commonResult
}
func (r GetResult) Extract() (*RespSecurityGroupEntity, error) {
var entity RespSecurityGroupEntity
err := r.ExtractIntoStructPtr(&entity, "security_group")
return &entity, err
}
// SecurityGroups 安全组列表对象
type SecurityGroups struct {
SecurityGroups []RespSecurityGroupEntity `json:"security_groups"`
Count int `json:"count"`
}
type ListResult struct {
commonResult
}
func (r ListResult) Extract() (*SecurityGroups, error) {
var entity SecurityGroups
err := r.ExtractIntoStructPtr(&entity, "")
return &entity, err
}