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

     1  package bandwidths
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  //BandWidth is a struct that represents a bandwidth
     8  type BandWidth struct {
     9  	ID        string `json:"id"`
    10  	Name      string `json:"name"`
    11  	Size      int    `json:"size"`
    12  	ShareType string `json:"share_type"`
    13  	//PublicIPInfo  string `json:"publicip_info"`
    14  	TenantID      string `json:"tenant_id"`
    15  	BandwidthType string `json:"bandwidth_type"`
    16  	ChargeMode    string `json:"charge_mode"`
    17  
    18  	PublicipInfo []PublicIpinfo `json:"publicip_info"`
    19  
    20  	// Specifies the billing information.
    21  	BillingInfo string `json:"billing_info"`
    22  
    23  	// Enterprise project id
    24  	EnterpriseProjectID string `json:"enterprise_project_id"`
    25  
    26  	// Status
    27  	Status string `json:"status"`
    28  }
    29  
    30  type PublicIpinfo struct {
    31  	// Specifies the tenant ID of the user.
    32  	PublicipId string `json:"publicip_id"`
    33  
    34  	// Specifies the elastic IP address.
    35  	PublicipAddress string `json:"publicip_address"`
    36  
    37  	// Specifies the elastic IP v6 address.
    38  	Publicipv6Address string `json:"publicipv6_address"`
    39  
    40  	// Specifies the elastic IP version.
    41  	IPVersion int `json:"ip_version"`
    42  
    43  	// Specifies the elastic IP address type. The value can be
    44  	// 5_telcom, 5_union, or 5_bgp.
    45  	PublicipType string `json:"publicip_type"`
    46  }
    47  
    48  //GetResult is a return struct of get method
    49  type GetResult struct {
    50  	golangsdk.Result
    51  }
    52  
    53  func (r GetResult) Extract() (BandWidth, error) {
    54  	var BW struct {
    55  		BW BandWidth `json:"bandwidth"`
    56  	}
    57  	err := r.Result.ExtractInto(&BW)
    58  	return BW.BW, err
    59  }
    60  
    61  //UpdateResult is a struct which contains the result of update method
    62  type UpdateResult struct {
    63  	golangsdk.Result
    64  }
    65  
    66  func (r UpdateResult) Extract() (BandWidth, error) {
    67  	var bw BandWidth
    68  	err := r.Result.ExtractIntoStructPtr(&bw, "bandwidth")
    69  	return bw, err
    70  }
    71  
    72  //ListResult is a struct which contains the result of list method
    73  type ListResult struct {
    74  	golangsdk.Result
    75  }
    76  
    77  func (r ListResult) Extract() ([]BandWidth, error) {
    78  	var s []BandWidth
    79  	err := r.ExtractIntoSlicePtr(&s, "bandwidths")
    80  	return s, err
    81  }