github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/ims/v1/others/ShowImageQuota.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 ShowImageQuota(client *golangsdk.ServiceClient) ([]QuotaInfo, error) {
     9  	// GET /v1/cloudimages/quota
    10  	raw, err := client.Get(client.ServiceURL("cloudimages", "quota"), nil, nil)
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	var res struct {
    16  		Resources []QuotaInfo `json:"resources"`
    17  	}
    18  	err = extract.IntoStructPtr(raw.Body, &res, "quotas")
    19  	return res.Resources, err
    20  }
    21  
    22  type QuotaInfo struct {
    23  	// Specifies the type of the resource to be queried.
    24  	Type string `json:"type"`
    25  	// Specifies the used quota.
    26  	Used int `json:"used"`
    27  	// Specifies the total quota.
    28  	Quota int `json:"quota"`
    29  	// Specifies the minimum quota.
    30  	Min int `json:"min"`
    31  	// Specifies the maximum quota.
    32  	Max int `json:"max"`
    33  }