github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/evs/extensions/quotasets/update.go (about) 1 package quotasets 2 3 import ( 4 "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 func Update(client *golangsdk.ServiceClient, projectID string, opts UpdateOpts) (*QuotaSet, error) { 9 b, err := golangsdk.BuildRequestBody(opts, "quota_set") 10 if err != nil { 11 return nil, err 12 } 13 14 raw, err := client.Put(client.ServiceURL("os-quota-sets", projectID), b, nil, &golangsdk.RequestOpts{ 15 OkCodes: []int{200}, 16 }) 17 if err != nil { 18 return nil, err 19 } 20 21 var res QuotaSet 22 err = extract.IntoStructPtr(raw.Body, &res, "quota_set") 23 return &res, err 24 } 25 26 type UpdateOpts struct { 27 // Volumes is the number of volumes that are allowed for each project. 28 Volumes *int `json:"volumes,omitempty"` 29 // Snapshots is the number of snapshots that are allowed for each project. 30 Snapshots *int `json:"snapshots,omitempty"` 31 // Gigabytes is the size (GB) of volumes and snapshots that are allowed for 32 // each project. 33 Gigabytes *int `json:"gigabytes,omitempty"` 34 // PerVolumeGigabytes is the size (GB) of volumes and snapshots that are 35 // allowed for each project and the specifed volume type. 36 PerVolumeGigabytes *int `json:"per_volume_gigabytes,omitempty"` 37 // Backups is the number of backups that are allowed for each project. 38 Backups *int `json:"backups,omitempty"` 39 // BackupGigabytes is the size (GB) of backups that are allowed for each 40 // project. 41 BackupGigabytes *int `json:"backup_gigabytes,omitempty"` 42 // Groups is the number of groups that are allowed for each project. 43 Groups *int `json:"groups,omitempty"` 44 // Force will update the quotaset even if the quota has already been used 45 // and the reserved quota exceeds the new quota. 46 Force bool `json:"force,omitempty"` 47 }