github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/ces/v1/quotas/results.go (about) 1 package quotas 2 3 import ( 4 "fmt" 5 6 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 7 ) 8 9 type ShowQuotasResponse struct { 10 Quotas Quotas `json:"quotas,omitempty"` 11 } 12 13 type Quotas struct { 14 // Specifies the resource quota list. 15 Resources []Resource `json:"resources"` 16 } 17 18 type Resource struct { 19 // Specifies the quota type. 20 Type string `json:"type"` 21 // Specifies the used amount of the quota. 22 Used int `json:"used"` 23 // Specifies the quota unit. 24 Unit string `json:"unit"` 25 // Specifies the total amount of the quota. 26 Quota int `json:"quota"` 27 } 28 29 type ShowQuotasResult struct { 30 golangsdk.Result 31 } 32 33 func (r ShowQuotasResult) Extract() (*ShowQuotasResponse, error) { 34 var s = ShowQuotasResponse{} 35 if r.Err != nil { 36 return nil, r.Err 37 } 38 err := r.ExtractInto(&s) 39 if err != nil { 40 return nil, fmt.Errorf("failed to extract Show Quotas Response") 41 } 42 return &s, nil 43 }