github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/evs/extensions/quotasets/get.go (about) 1 package quotasets 2 3 import ( 4 "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 func Get(client *golangsdk.ServiceClient, projectID string) (*QuotaSet, error) { 9 raw, err := client.Get(client.ServiceURL("os-quota-sets", projectID), nil, nil) 10 if err != nil { 11 return nil, err 12 } 13 14 var res struct { 15 QuotaSet QuotaSet `json:"quota_set"` 16 } 17 err = extract.Into(raw.Body, &res) 18 return &res.QuotaSet, err 19 } 20 21 func GetDefaults(client *golangsdk.ServiceClient, projectID string) (*QuotaSet, error) { 22 raw, err := client.Get(client.ServiceURL("os-quota-sets", projectID, "defaults"), nil, nil) 23 if err != nil { 24 return nil, err 25 } 26 27 var res QuotaSet 28 err = extract.IntoStructPtr(raw.Body, &res, "quota_set") 29 return &res, err 30 } 31 32 type QuotaSet struct { 33 // ID is project associated with this QuotaSet. 34 ID string `json:"id"` 35 // Volumes is the number of volumes that are allowed for each project. 36 Volumes int `json:"volumes"` 37 // Snapshots is the number of snapshots that are allowed for each project. 38 Snapshots int `json:"snapshots"` 39 // Gigabytes is the size (GB) of volumes and snapshots that are allowed for 40 // each project. 41 Gigabytes int `json:"gigabytes"` 42 // PerVolumeGigabytes is the size (GB) of volumes and snapshots that are 43 // allowed for each project and the specifed volume type. 44 PerVolumeGigabytes int `json:"per_volume_gigabytes"` 45 // Backups is the number of backups that are allowed for each project. 46 Backups int `json:"backups"` 47 // BackupGigabytes is the size (GB) of backups that are allowed for each 48 // project. 49 BackupGigabytes int `json:"backup_gigabytes"` 50 }