github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/autoscaling/v1/quotas/ShowResourceQuota.go (about)

     1  package quotas
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  func ShowResourceQuota(client *golangsdk.ServiceClient) (*AllQuotas, error) {
     9  	// GET https://{Endpoint}/autoscaling-api/v1/{project_id}/quotas
    10  	raw, err := client.Get(client.ServiceURL("quotas"), nil, nil)
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	var res AllQuotas
    16  	err = extract.IntoStructPtr(raw.Body, &res, "quotas")
    17  	return &res, err
    18  }
    19  
    20  type AllQuotas struct {
    21  	Resources []AllResources `json:"resources,omitempty"`
    22  }
    23  
    24  type AllResources struct {
    25  	// Specifies the quota type.
    26  	// scaling_Group: AS group quota
    27  	// scaling_Config: AS configuration quota
    28  	// scaling_Policy: AS policy quota
    29  	// scaling_Instance: instance quota
    30  	// bandwidth_scaling_policy: bandwidth scaling policy quota
    31  	Type string `json:"type,omitempty"`
    32  	// Specifies the used amount of the quota.
    33  	// When type is set to scaling_Policy or scaling_Instance,
    34  	// this parameter is reserved, and the system returns -1 as the parameter value.
    35  	// You can query the used quota of AS policies and AS instances in a specified AS group.
    36  	Used int32 `json:"used,omitempty"`
    37  	// Specifies the total quota.
    38  	Quota int32 `json:"quota,omitempty"`
    39  	// Specifies the quota upper limit.
    40  	Max int32 `json:"max,omitempty"`
    41  	// Specifies the quota lower limit.
    42  	Min int32 `json:"min,omitempty"`
    43  }