github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/iec/v1/bandwidths/results.go (about)

     1  package bandwidths
     2  
     3  import (
     4  	"github.com/chnsz/golangsdk"
     5  	"github.com/chnsz/golangsdk/openstack/iec/v1/common"
     6  )
     7  
     8  type commonResult struct {
     9  	golangsdk.Result
    10  }
    11  
    12  //BandWidthObject 带宽的结构体,用于创建和更新请求
    13  type BandWidthObject struct {
    14  	BandWidth common.Bandwidth `json:"bandwidth"`
    15  }
    16  
    17  type GetResult struct {
    18  	commonResult
    19  }
    20  
    21  func (r GetResult) Extract() (*BandWidthObject, error) {
    22  	var entity BandWidthObject
    23  	err := r.ExtractIntoStructPtr(&entity, "")
    24  	return &entity, err
    25  }
    26  
    27  type UpdateResult struct {
    28  	commonResult
    29  }
    30  
    31  func (r UpdateResult) Extract() (*BandWidthObject, error) {
    32  	var entity BandWidthObject
    33  	err := r.ExtractIntoStructPtr(&entity, "")
    34  	return &entity, err
    35  }
    36  
    37  // BandWidths 共享带宽列表对象
    38  type BandWidths struct {
    39  	BandWidth []common.Bandwidth `json:"bandwidths"`
    40  	Count     int                `json:"count"`
    41  }
    42  
    43  type ListResult struct {
    44  	commonResult
    45  }
    46  
    47  func (r ListResult) Extract() (*BandWidths, error) {
    48  	var entity BandWidths
    49  	err := r.ExtractIntoStructPtr(&entity, "")
    50  	return &entity, err
    51  }