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