github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/dns/v2/ipaddress/results.go (about) 1 package ipaddress 2 3 import "github.com/chnsz/golangsdk" 4 5 type commonResult struct { 6 golangsdk.Result 7 } 8 9 type CreateResult struct { 10 commonResult 11 } 12 13 type ListResult struct { 14 commonResult 15 } 16 17 type DeleteResult struct { 18 golangsdk.ErrResult 19 } 20 21 type ListObject struct { 22 Status string `json:"status"` 23 ID string `json:"id"` 24 IP string `json:"ip"` 25 CreateTime string `json:"create_time"` 26 UpdateTime string `json:"update_time"` 27 SubnetID string `json:"subnet_id"` 28 ErrorInfo string `json:"error_info"` 29 } 30 31 type EndpointResp struct { 32 ID string `json:"id"` 33 Name string `json:"name"` 34 Status string `json:"status"` 35 VpcID string `json:"vpc_id"` 36 IPAddressCount int `json:"ipaddress_count"` 37 ResolverRuleCount int `json:"resolver_rule_count"` 38 CreateTime string `json:"create_time"` 39 UpdateTime string `json:"update_time"` 40 } 41 42 func (c CreateResult) Extract() (EndpointResp, error) { 43 type responseBody struct { 44 EndpointResp `json:"endpoint"` 45 } 46 var r responseBody 47 err := c.ExtractInto(&r) 48 return r.EndpointResp, err 49 } 50 51 func (l ListResult) Extract() ([]ListObject, error) { 52 type result struct { 53 IPAddress []ListObject `json:"ipaddresses"` 54 } 55 var r result 56 err := l.ExtractInto(&r) 57 return r.IPAddress, err 58 }