github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcs/v1/others/ShowTenantQuota.go (about) 1 package others 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 func ShowTenantQuota(client *golangsdk.ServiceClient) (*ShowQuotaOfTenantResponse, error) { 9 raw, err := client.Get(client.ServiceURL("quota"), nil, nil) 10 if err != nil { 11 return nil, err 12 } 13 14 var res ShowQuotaOfTenantResponse 15 err = extract.IntoStructPtr(raw.Body, &res, "quotas") 16 return &res, err 17 } 18 19 type ShowQuotaOfTenantResponse struct { 20 // List of quotas. 21 Resources []Resources `json:"resources"` 22 // Information about a resource tenant 23 ResourceUser ResourceUser `json:"resource_user"` 24 } 25 26 type Resources struct { 27 // Resource unit. 28 // When type is set to instance, no value is returned. 29 // When type is set to ram, GB is returned. 30 Unit string `json:"unit"` 31 // Indicates the minimum limit of instance quota when type is set to instance. 32 // Indicates the minimum limit of memory quota when type is set to ram. 33 Min int32 `json:"min"` 34 // Indicates the maximum limit of instance quota when type is set to instance. 35 // Indicates the maximum limit of memory quota when type is set to ram. 36 Max int32 `json:"max"` 37 // Maximum number of instances that can be created and maximum allowed total memory. 38 Quota int32 `json:"quota"` 39 // Number of created instances and used memory. 40 Used int32 `json:"used"` 41 // Values: 42 // instances: indicates the instance quota. 43 // ram: indicates the memory quota. 44 Type string `json:"type"` 45 } 46 47 type ResourceUser struct { 48 // Resource tenant ID 49 TenantId string `json:"tenant_id"` 50 // Resource tenant name 51 TenantName string `json:"tenant_name"` 52 }