github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/elb/v3/loadbalancers/results.go (about) 1 package loadbalancers 2 3 import ( 4 "github.com/chnsz/golangsdk" 5 ) 6 7 // LoadBalancer is the primary load balancing configuration object that 8 // specifies the virtual IP address on which client traffic is received, as well 9 // as other details such as the load balancing method to be use, protocol, etc. 10 type LoadBalancer struct { 11 // The unique ID for the LoadBalancer. 12 ID string `json:"id"` 13 14 // Human-readable description for the Loadbalancer. 15 Description string `json:"description"` 16 17 // The provisioning status of the LoadBalancer. 18 // This value is ACTIVE, PENDING_CREATE or ERROR. 19 ProvisioningStatus string `json:"provisioning_status"` 20 21 // The administrative state of the Loadbalancer. 22 // A valid value is true (UP) or false (DOWN). 23 AdminStateUp bool `json:"admin_state_up"` 24 25 // The name of the provider. 26 Provider string `json:"provider"` 27 28 // Pools are the pools related to this Loadbalancer. 29 Pools []PoolRef `json:"pools"` 30 31 // Listeners are the listeners related to this Loadbalancer. 32 Listeners []ListenerRef `json:"listeners"` 33 34 // The operating status of the LoadBalancer. This value is ONLINE or OFFLINE. 35 OperatingStatus string `json:"operating_status"` 36 37 // The IP address of the Loadbalancer. 38 VipAddress string `json:"vip_address"` 39 40 // The UUID of the subnet on which to allocate the virtual IP for the 41 // Loadbalancer address. 42 VipSubnetCidrID string `json:"vip_subnet_cidr_id"` 43 44 // Human-readable name for the LoadBalancer. Does not have to be unique. 45 Name string `json:"name"` 46 47 // Owner of the LoadBalancer. 48 ProjectID string `json:"project_id"` 49 50 // The UUID of the port associated with the IP address. 51 VipPortID string `json:"vip_port_id"` 52 53 // The UUID of a flavor if set. 54 Tags []Tag `json:"tags"` 55 56 // Guaranteed. 57 Guaranteed bool `json:"guaranteed"` 58 59 // The VPC ID. 60 VpcID string `json:"vpc_id"` 61 62 // EIP Info. 63 Eips []EipInfo `json:"eips"` 64 65 // Ipv6 Vip Address. 66 Ipv6VipAddress string `json:"ipv6_vip_address"` 67 68 // Ipv6 Vip Virsubnet ID. 69 Ipv6VipVirsubnetID string `json:"ipv6_vip_virsubnet_id"` 70 71 // Ipv6 Vip Port ID. 72 Ipv6VipPortID string `json:"ipv6_vip_port_id"` 73 74 // Availability Zone List. 75 AvailabilityZoneList []string `json:"availability_zone_list"` 76 77 // The UUID of the enterprise project who owns the Loadbalancer. 78 EnterpriseProjectID string `json:"enterprise_project_id"` 79 80 // Billing Info. 81 BillingInfo string `json:"billing_info"` 82 83 // L4 Flavor ID. 84 L4FlavorID string `json:"l4_flavor_id"` 85 86 // L4 Scale Flavor ID. 87 L4ScaleFlavorID string `json:"l4_scale_flavor_id"` 88 89 // L7 Flavor ID. 90 L7FlavorID string `json:"l7_flavor_id"` 91 92 // L7 Scale Flavor ID. 93 L7ScaleFlavorID string `json:"l7_scale_flavor_id"` 94 95 // Public IP Info. 96 PublicIps []PublicIpInfo `json:"publicips"` 97 98 // Elb Virsubnet IDs. 99 ElbVirsubnetIDs []string `json:"elb_virsubnet_ids"` 100 101 // Elb Virsubnet Type. 102 ElbVirsubnetType string `json:"elb_virsubnet_type"` 103 104 // Ip Target Enable. 105 IpTargetEnable bool `json:"ip_target_enable"` 106 107 // Frozen Scene. 108 FrozenScene string `json:"frozen_scene"` 109 110 // Ipv6 Bandwidth. 111 IPV6Bandwidth BandwidthRef `json:"ipv6_bandwidth"` 112 113 // Update protection status 114 ProtectionStatus string `json:"protection_status"` 115 116 // Update protection reason 117 ProtectionReason string `json:"protection_reason"` 118 119 // Deletion Protection Enable. 120 DeletionProtectionEnable bool `json:"deletion_protection_enable"` 121 122 // Autoscaling configuration 123 AutoScaling AutoScaling `json:"autoscaling"` 124 125 // Waf failure action 126 WafFailureAction string `json:"waf_failure_action"` 127 128 // Charge Mode 129 ChargeMode string `json:"charge_mode"` 130 131 // Creation time 132 CreatedAt string `json:"created_at"` 133 134 // Update time 135 UpdatedAt string `json:"updated_at"` 136 } 137 138 // EipInfo 139 type EipInfo struct { 140 // Eip ID 141 EipID string `json:"eip_id"` 142 // Eip Address 143 EipAddress string `json:"eip_address"` 144 // Eip Address 145 IpVersion int `json:"ip_version"` 146 } 147 148 // PoolRef 149 type PoolRef struct { 150 ID string `json:"id"` 151 } 152 153 // ListenerRef 154 type ListenerRef struct { 155 ID string `json:"id"` 156 } 157 158 // PublicIPInfo 159 type PublicIpInfo struct { 160 // Public IP ID 161 PublicIpID string `json:"publicip_id"` 162 // Public IP Address 163 PublicIpAddress string `json:"publicip_address"` 164 // IP Version 165 IpVersion int `json:"ip_version"` 166 } 167 168 // StatusTree represents the status of a loadbalancer. 169 type StatusTree struct { 170 Loadbalancer *LoadBalancer `json:"loadbalancer"` 171 } 172 173 // Prepaid response 174 type PrepaidResponse struct { 175 LoadBalancerID string `json:"loadbalancer_id"` 176 OrderID string `json:"order_id"` 177 } 178 179 type commonResult struct { 180 golangsdk.Result 181 } 182 183 // Extract is a function that accepts a result and extracts a loadbalancer. 184 func (r commonResult) Extract() (*LoadBalancer, error) { 185 var s struct { 186 LoadBalancer *LoadBalancer `json:"loadbalancer"` 187 } 188 err := r.ExtractInto(&s) 189 return s.LoadBalancer, err 190 } 191 192 // Extract is a function that accepts a result and extracts a loadbalancer. 193 func (r commonResult) ExtractPrepaid() (*PrepaidResponse, error) { 194 var s PrepaidResponse 195 err := r.ExtractInto(&s) 196 return &s, err 197 } 198 199 // GetStatusesResult represents the result of a GetStatuses operation. 200 // Call its Extract method to interpret it as a StatusTree. 201 type GetStatusesResult struct { 202 golangsdk.Result 203 } 204 205 // Extract is a function that accepts a result and extracts the status of 206 // a Loadbalancer. 207 func (r GetStatusesResult) Extract() (*StatusTree, error) { 208 var s struct { 209 Statuses *StatusTree `json:"statuses"` 210 } 211 err := r.ExtractInto(&s) 212 return s.Statuses, err 213 } 214 215 // ChangeResult represents the result of a ChangeChargingMode operation. 216 // Call its Extract method to get the order ID. 217 type ChangeResult struct { 218 golangsdk.Result 219 } 220 221 // Extract is a function that accepts a result and extracts the order ID. 222 func (r ChangeResult) Extract() (string, error) { 223 var s struct { 224 LoadBalancerIdList []string `json:"loadbalancer_id_list"` 225 EipIdList []string `json:"eip_id_list"` 226 OrderId string `json:"order_id"` 227 } 228 err := r.ExtractInto(&s) 229 return s.OrderId, err 230 } 231 232 // CreateResult represents the result of a create operation. Call its Extract 233 // method to interpret it as a LoadBalancer. 234 type CreateResult struct { 235 commonResult 236 } 237 238 // GetResult represents the result of a get operation. Call its Extract 239 // method to interpret it as a LoadBalancer. 240 type GetResult struct { 241 commonResult 242 } 243 244 // UpdateResult represents the result of an update operation. Call its Extract 245 // method to interpret it as a LoadBalancer. 246 type UpdateResult struct { 247 commonResult 248 } 249 250 // DeleteResult represents the result of a delete operation. Call its 251 // ExtractErr method to determine if the request succeeded or failed. 252 type DeleteResult struct { 253 golangsdk.ErrResult 254 }