github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/iec/v1/security/groups/results.go (about) 1 package groups 2 3 import ( 4 "github.com/huaweicloud/golangsdk" 5 "github.com/huaweicloud/golangsdk/openstack/iec/v1/common" 6 ) 7 8 type commonResult struct { 9 golangsdk.Result 10 } 11 12 //RespSecurityGroupEntity 获取安全组信息时候,返回结构体 13 type RespSecurityGroupEntity struct { 14 ID string `json:"id"` 15 Name string `json:"name"` 16 Description string `json:"description"` 17 SecurityGroupRules []common.RespSecurityGroupRuleEntity `json:"security_group_rules"` 18 } 19 20 type CreateResult struct { 21 commonResult 22 } 23 24 func (r CreateResult) Extract() (*RespSecurityGroupEntity, error) { 25 var entity RespSecurityGroupEntity 26 err := r.ExtractIntoStructPtr(&entity, "security_group") 27 return &entity, err 28 } 29 30 type DeleteResult struct { 31 golangsdk.ErrResult 32 } 33 34 type GetResult struct { 35 commonResult 36 } 37 38 func (r GetResult) Extract() (*RespSecurityGroupEntity, error) { 39 var entity RespSecurityGroupEntity 40 err := r.ExtractIntoStructPtr(&entity, "security_group") 41 return &entity, err 42 } 43 44 // SecurityGroups 安全组列表对象 45 type SecurityGroups struct { 46 SecurityGroups []RespSecurityGroupEntity `json:"security_groups"` 47 Count int `json:"count"` 48 } 49 50 type ListResult struct { 51 commonResult 52 } 53 54 func (r ListResult) Extract() (*SecurityGroups, error) { 55 var entity SecurityGroups 56 err := r.ExtractIntoStructPtr(&entity, "") 57 return &entity, err 58 }