-
Notifications
You must be signed in to change notification settings - Fork 3
/
load_balancers.go
59 lines (50 loc) · 1.93 KB
/
load_balancers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package cloudscale
import (
"time"
)
const loadBalancerBasePath = "v1/load-balancers"
type LoadBalancerStub struct {
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
}
type LoadBalancerFlavorStub struct {
Slug string `json:"slug,omitempty"`
Name string `json:"name,omitempty"`
}
type LoadBalancer struct {
ZonalResource
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
Flavor LoadBalancerFlavorStub `json:"flavor,omitempty"`
Status string `json:"status,omitempty"`
VIPAddresses []VIPAddress `json:"vip_addresses,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
type VIPAddress struct {
Version int `json:"version,omitempty"`
Address string `json:"address,omitempty"`
Subnet SubnetStub `json:"subnet,omitempty"`
}
type LoadBalancerRequest struct {
ZonalResourceRequest
TaggedResourceRequest
Name string `json:"name,omitempty"`
Flavor string `json:"flavor,omitempty"`
VIPAddresses *[]VIPAddressRequest `json:"vip_addresses,omitempty"`
}
type VIPAddressRequest struct {
Address string `json:"address,omitempty"`
Subnet string `json:"subnet,omitempty"`
}
type LoadBalancerService interface {
GenericCreateService[LoadBalancer, LoadBalancerRequest, LoadBalancerRequest]
GenericGetService[LoadBalancer, LoadBalancerRequest, LoadBalancerRequest]
GenericListService[LoadBalancer, LoadBalancerRequest, LoadBalancerRequest]
GenericUpdateService[LoadBalancer, LoadBalancerRequest, LoadBalancerRequest]
GenericDeleteService[LoadBalancer, LoadBalancerRequest, LoadBalancerRequest]
}