github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/elb/v3/ipgroups/results.go (about) 1 package ipgroups 2 3 import ( 4 "github.com/huaweicloud/golangsdk" 5 ) 6 7 type ListenerID struct { 8 ID string `json:"id"` 9 } 10 11 type IpGroup struct { 12 // The unique ID for the IpGroup. 13 ID string `json:"id"` 14 15 // Human-readable name for the IpGroup. 16 Name string `json:"name"` 17 18 // Human-readable description for the IpGroup. 19 Description string `json:"description"` 20 21 // whether to use HTTP2. 22 Http2Enable bool `json:"http2_enable"` 23 24 // A list of listener IDs. 25 Listeners []ListenerID `json:"listeners"` 26 27 // A list of IP addresses. 28 IpList []IpListOpt `json:"ip_list"` 29 } 30 31 type commonResult struct { 32 golangsdk.Result 33 } 34 35 // Extract is a function that accepts a result and extracts a ipgroup. 36 func (r commonResult) Extract() (*IpGroup, error) { 37 var s struct { 38 IpGroup *IpGroup `json:"ipgroup"` 39 } 40 err := r.ExtractInto(&s) 41 return s.IpGroup, err 42 } 43 44 // CreateResult represents the result of a create operation. Call its Extract 45 // method to interpret it as a IpGroup. 46 type CreateResult struct { 47 commonResult 48 } 49 50 // GetResult represents the result of a get operation. Call its Extract 51 // method to interpret it as a IpGroup. 52 type GetResult struct { 53 commonResult 54 } 55 56 // UpdateResult represents the result of an update operation. Call its Extract 57 // method to interpret it as a IpGroup. 58 type UpdateResult struct { 59 commonResult 60 } 61 62 // DeleteResult represents the result of a delete operation. Call its 63 // ExtractErr method to determine if the request succeeded or failed. 64 type DeleteResult struct { 65 golangsdk.ErrResult 66 }