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

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