github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/elb/quotas/results.go (about)

     1  package quotas
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  type ResourceQuota struct {
     8  	Type  string `json:"type"`
     9  	Used  int    `json:"used"`
    10  	Quota int    `json:"quota"`
    11  	Max   int    `json:"max"`
    12  	Min   int    `json:"min"`
    13  }
    14  
    15  type resources struct {
    16  	Resources []ResourceQuota `json:"resources"`
    17  }
    18  
    19  type quotaInfo struct {
    20  	Quotas resources `json:"quotas"`
    21  }
    22  
    23  type GetResult struct {
    24  	golangsdk.Result
    25  }
    26  
    27  func (r GetResult) Extract() ([]ResourceQuota, error) {
    28  	s := &quotaInfo{}
    29  	err := r.ExtractInto(s)
    30  	if err == nil {
    31  		return s.Quotas.Resources, nil
    32  	}
    33  	return nil, err
    34  }