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

     1  package datastores
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  	"github.com/huaweicloud/golangsdk/pagination"
     6  )
     7  
     8  type DataStoresResult struct {
     9  	golangsdk.Result
    10  }
    11  type DataStores struct {
    12  	DataStores []dataStores `json:"dataStores" `
    13  }
    14  type dataStores struct {
    15  	Id   string `json:"id" `
    16  	Name string `json:"name"`
    17  }
    18  
    19  type DataStoresPage struct {
    20  	pagination.SinglePageBase
    21  }
    22  
    23  func (r DataStoresPage) IsEmpty() (bool, error) {
    24  	data, err := ExtractDataStores(r)
    25  	if err != nil {
    26  		return false, err
    27  	}
    28  	return len(data.DataStores) == 0, err
    29  }
    30  
    31  func ExtractDataStores(r pagination.Page) (DataStores, error) {
    32  	var s DataStores
    33  	err := (r.(DataStoresPage)).ExtractInto(&s)
    34  	return s, err
    35  }