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

     1  package templates
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  	"github.com/huaweicloud/golangsdk/openstack/cce/v3/addons"
     6  )
     7  
     8  type commonResult struct {
     9  	golangsdk.Result
    10  }
    11  
    12  type ListResutlt struct {
    13  	commonResult
    14  }
    15  
    16  type Template struct {
    17  	Kind       string   `json:"kind"`
    18  	ApiVersion string   `json:"apiVersion"`
    19  	Metadata   Metadata `json:"metadata"`
    20  	Spec       Spec     `json:"spec"`
    21  }
    22  
    23  type Metadata struct {
    24  	UID               string `json:"uid"`
    25  	Name              string `json:"name"`
    26  	CreationTimestamp string `json:"creationTimestamp"`
    27  	UpdateTimestamp   string `json:"updateTimestamp"`
    28  }
    29  
    30  type Spec struct {
    31  	Type        string            `json:"type"`
    32  	Labels      []string          `json:"labels"`
    33  	LogoURL     string            `json:"logoURL"`
    34  	Description string            `json:"description"`
    35  	Versions    []addons.Versions `json:"versions"`
    36  }
    37  
    38  func (r ListResutlt) Extract() ([]Template, error) {
    39  	var s struct {
    40  		Templates []Template `json:"items"`
    41  	}
    42  	err := r.ExtractInto(&s)
    43  	return s.Templates, err
    44  }