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

     1  package edgeclouds
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/huaweicloud/golangsdk"
     7  	"github.com/huaweicloud/golangsdk/openstack/iec/v1/common"
     8  	"github.com/huaweicloud/golangsdk/openstack/iec/v1/servers"
     9  )
    10  
    11  // EdgeCloud 边缘业务详情
    12  type EdgeCloud struct {
    13  	ID             string          `json:"id,omitempty"`
    14  	Name           string          `json:"name,omitempty"`
    15  	Description    string          `json:"description,omitempty"`
    16  	StackOptsSlice []StackDetail   `json:"stacks"`
    17  	Coverage       common.Coverage `json:"coverage"`
    18  	DeploymentIDs  []string        `json:"-"`
    19  	ServerCount    int             `json:"-"`
    20  	SuccessNum     int             `json:"success_num"`
    21  	FailedNum      int             `json:"failed_num"`
    22  	Status         string          `json:"status"`
    23  	FailMessage    FailReason      `json:"fail_reason,omitempty"`
    24  	// 边缘业务支持的边缘区域数目,等同于边缘业务下所有实例的区域数目总和
    25  	EdgeRegions int `json:"edge_regions,omitempty"`
    26  	TimeModel
    27  }
    28  
    29  // TimeModel record the time of creating, updating, deleting
    30  type TimeModel struct {
    31  	CreateAt time.Time `orm:"column(CREATEAT);type(datetime);auto_now_add" json:"create_at,omitempty"`
    32  	UpdateAt time.Time `orm:"column(UPDATEAT);type(datetime);auto_now" json:"update_at,omitempty"`
    33  	DeleteAt time.Time `orm:"column(DELETEAT);type(datetime)" json:"-"`
    34  	Deleted  string    `orm:"column(DELETED)" json:"-"`
    35  }
    36  
    37  // FailReason 失败缘由,只有失败的边缘业务中会显示
    38  type FailReason struct {
    39  	ErrorCode    string `json:"fail_code,omitempty"`
    40  	ErrorMessage string `json:"fail_message,omitempty"`
    41  }
    42  
    43  // StackDetail Stack详情
    44  type StackDetail struct {
    45  	//ID
    46  	ID string `json:"id"`
    47  
    48  	//NAME
    49  	Name string `json:"name"`
    50  
    51  	Resources SliceResourceOptsField `json:"resources"`
    52  }
    53  
    54  // SliceResourceOptsField A slice string field.
    55  type SliceResourceOptsField []servers.CreateOpts
    56  
    57  type commonResult struct {
    58  	golangsdk.Result
    59  }
    60  
    61  type GetResult struct {
    62  	commonResult
    63  }
    64  
    65  func (r GetResult) Extract() (*EdgeCloud, error) {
    66  	var entity EdgeCloud
    67  	err := r.ExtractIntoStructPtr(&entity, "")
    68  	return &entity, err
    69  }
    70  
    71  type DeleteResult struct {
    72  	golangsdk.ErrResult
    73  }