github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/iec/v1/images/results.go (about)

     1  package images
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk/openstack/iec/v1/common"
     5  	"github.com/huaweicloud/golangsdk/pagination"
     6  )
     7  
     8  // EdgeImages 边缘镜像列表信息
     9  type EdgeImages struct {
    10  	Total  int                    `json:"total"`
    11  	Images []common.EdgeImageInfo `json:"images"`
    12  }
    13  
    14  // ImagePage represents the results of a List request.
    15  type ImagePage struct {
    16  	pagination.LinkedPageBase
    17  }
    18  
    19  // IsEmpty returns true if a page contains no image results.
    20  func (r ImagePage) IsEmpty() (bool, error) {
    21  	s, err := ExtractImages(r)
    22  	return s.Total == 0, err
    23  }
    24  
    25  // ExtractImages 输出边缘镜像列表
    26  func ExtractImages(r pagination.Page) (EdgeImages, error) {
    27  	var s EdgeImages
    28  	err := (r.(ImagePage)).ExtractInto(&s)
    29  	return s, err
    30  }