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

     1  package bandwidths
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  type PrePaid struct {
     8  	OrderID string `json:"order_id"`
     9  }
    10  
    11  type PostPaid struct {
    12  	Name                string         `json:"name"`
    13  	Size                int            `json:"size"`
    14  	ID                  string         `json:"id"`
    15  	ShareType           string         `json:"share_type"`
    16  	ChargeMode          string         `json:"charge_mode"`
    17  	BandwidthType       string         `json:"bandwidth_type"`
    18  	TenantID            string         `json:"tenant_id"`
    19  	PublicipInfo        []PublicipInfo `json:"publicip_info"`
    20  	EnterpriseProjectID string         `json:"enterprise_project_id"`
    21  	//BillingInfo         string         `json:"billing_info"`
    22  }
    23  
    24  type PublicipInfo struct {
    25  	PublicipID        string `json:"publicip_id"`
    26  	PublicIPAddress   string `json:"publicip_address"`
    27  	Publicipv6Address string `json:"publicipv_6_address"`
    28  	IpVersion         int    `json:"ip_version"`
    29  	PublicipType      string `json:"publicip_type"`
    30  }
    31  
    32  type UpdateResult struct {
    33  	golangsdk.Result
    34  }
    35  
    36  func (r UpdateResult) ExtractOrderID() (PrePaid, error) {
    37  	var s PrePaid
    38  	err := r.ExtractInto(&s)
    39  	return s, err
    40  }
    41  
    42  func (r UpdateResult) Extract() (PostPaid, error) {
    43  	var s struct {
    44  		Bandwidth PostPaid `json:"bandwidth"`
    45  	}
    46  	err := r.ExtractInto(&s)
    47  	return s.Bandwidth, err
    48  }
    49  
    50  type CreateResult struct {
    51  	golangsdk.Result
    52  }
    53  
    54  func (r CreateResult) Extract() (*BandWidth, error) {
    55  	var entity BandWidth
    56  	err := r.ExtractIntoStructPtr(&entity, "bandwidth")
    57  	return &entity, err
    58  }
    59  
    60  type BatchCreateResult struct {
    61  	golangsdk.Result
    62  }
    63  
    64  func (r BatchCreateResult) Extract() (*[]BandWidth, error) {
    65  	var entity []BandWidth
    66  	err := r.ExtractIntoSlicePtr(&entity, "bandwidths")
    67  	return &entity, err
    68  }
    69  
    70  type BandWidth struct {
    71  	// Specifies the bandwidth name. The value is a string of 1 to 64
    72  	// characters that can contain letters, digits, underscores (_), and hyphens (-).
    73  	Name string `json:"name"`
    74  
    75  	// Specifies the bandwidth size. The value ranges from 1 Mbit/s to
    76  	// 300 Mbit/s.
    77  	Size int `json:"size"`
    78  
    79  	// Specifies the bandwidth ID, which uniquely identifies the
    80  	// bandwidth.
    81  	ID string `json:"id"`
    82  
    83  	// Specifies whether the bandwidth is shared or exclusive. The
    84  	// value can be PER or WHOLE.
    85  	ShareType string `json:"share_type"`
    86  
    87  	// Specifies the elastic IP address of the bandwidth.  The
    88  	// bandwidth, whose type is set to WHOLE, supports up to 20 elastic IP addresses. The
    89  	// bandwidth, whose type is set to PER, supports only one elastic IP address.
    90  	PublicipInfo []PublicIpinfo `json:"publicip_info"`
    91  
    92  	// Specifies the tenant ID of the user.
    93  	TenantId string `json:"tenant_id"`
    94  
    95  	// Specifies the bandwidth type.
    96  	BandwidthType string `json:"bandwidth_type"`
    97  
    98  	// Specifies the charging mode (by traffic or by bandwidth).
    99  	ChargeMode string `json:"charge_mode"`
   100  
   101  	// Specifies the billing information.
   102  	BillingInfo string `json:"billing_info"`
   103  
   104  	// Enterprise project id
   105  	EnterpriseProjectID string `json:"enterprise_project_id"`
   106  
   107  	// Status
   108  	Status string `json:"status"`
   109  }
   110  
   111  type PublicIpinfo struct {
   112  	// Specifies the tenant ID of the user.
   113  	PublicipId string `json:"publicip_id"`
   114  
   115  	// Specifies the elastic IP address.
   116  	PublicipAddress string `json:"publicip_address"`
   117  
   118  	// Specifies the elastic IP v6 address.
   119  	Publicipv6Address string `json:"publicipv6_address"`
   120  
   121  	// Specifies the elastic IP version.
   122  	IPVersion int `json:"ip_version"`
   123  
   124  	// Specifies the elastic IP address type. The value can be
   125  	// 5_telcom, 5_union, or 5_bgp.
   126  	PublicipType string `json:"publicip_type"`
   127  }
   128  
   129  type DeleteResult struct {
   130  	golangsdk.ErrResult
   131  }