github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/rds/v3/flavors/results.go (about)

     1  package flavors
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk/pagination"
     5  )
     6  
     7  type DbFlavorsResp struct {
     8  	Flavorslist []Flavors `json:"flavors"`
     9  }
    10  type Flavors struct {
    11  	Vcpus        string            `json:"vcpus" `
    12  	Ram          int               `json:"ram" `
    13  	Speccode     string            `json:"spec_code"  `
    14  	Instancemode string            `json:"instance_mode" `
    15  	Azstatus     map[string]string `json:"az_status" `
    16  }
    17  
    18  type DbFlavorsPage struct {
    19  	pagination.SinglePageBase
    20  }
    21  
    22  func (r DbFlavorsPage) IsEmpty() (bool, error) {
    23  	data, err := ExtractDbFlavors(r)
    24  	if err != nil {
    25  		return false, err
    26  	}
    27  	return len(data.Flavorslist) == 0, err
    28  }
    29  
    30  func ExtractDbFlavors(r pagination.Page) (DbFlavorsResp, error) {
    31  	var s DbFlavorsResp
    32  	err := (r.(DbFlavorsPage)).ExtractInto(&s)
    33  	return s, err
    34  }