load balancers: add new enable_backend_keepalive field
This commit is contained in:
parent
4acd72d5f8
commit
e534d34652
|
@ -3,6 +3,7 @@
|
|||
## unreleased
|
||||
|
||||
- #310 Add BillingHistory service and List endpoint - @rbutler
|
||||
- #316 load balancers: add new enable_backend_keepalive field - @anitgandhi
|
||||
|
||||
## [v1.32.0] - 2020-03-04
|
||||
|
||||
|
|
|
@ -28,22 +28,23 @@ type LoadBalancersService interface {
|
|||
// LoadBalancer represents a DigitalOcean load balancer configuration.
|
||||
// Tags can only be provided upon the creation of a Load Balancer.
|
||||
type LoadBalancer struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
Algorithm string `json:"algorithm,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Created string `json:"created_at,omitempty"`
|
||||
ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"`
|
||||
HealthCheck *HealthCheck `json:"health_check,omitempty"`
|
||||
StickySessions *StickySessions `json:"sticky_sessions,omitempty"`
|
||||
Region *Region `json:"region,omitempty"`
|
||||
DropletIDs []int `json:"droplet_ids,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"`
|
||||
EnableProxyProtocol bool `json:"enable_proxy_protocol,omitempty"`
|
||||
VPCUUID string `json:"vpc_uuid,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
Algorithm string `json:"algorithm,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Created string `json:"created_at,omitempty"`
|
||||
ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"`
|
||||
HealthCheck *HealthCheck `json:"health_check,omitempty"`
|
||||
StickySessions *StickySessions `json:"sticky_sessions,omitempty"`
|
||||
Region *Region `json:"region,omitempty"`
|
||||
DropletIDs []int `json:"droplet_ids,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"`
|
||||
EnableProxyProtocol bool `json:"enable_proxy_protocol,omitempty"`
|
||||
EnableBackendKeepalive bool `json:"enable_backend_keepalive,omitempty"`
|
||||
VPCUUID string `json:"vpc_uuid,omitempty"`
|
||||
}
|
||||
|
||||
// String creates a human-readable description of a LoadBalancer.
|
||||
|
@ -59,15 +60,16 @@ func (l LoadBalancer) URN() string {
|
|||
// Modifying the returned LoadBalancerRequest will not modify the original LoadBalancer.
|
||||
func (l LoadBalancer) AsRequest() *LoadBalancerRequest {
|
||||
r := LoadBalancerRequest{
|
||||
Name: l.Name,
|
||||
Algorithm: l.Algorithm,
|
||||
ForwardingRules: append([]ForwardingRule(nil), l.ForwardingRules...),
|
||||
DropletIDs: append([]int(nil), l.DropletIDs...),
|
||||
Tag: l.Tag,
|
||||
RedirectHttpToHttps: l.RedirectHttpToHttps,
|
||||
EnableProxyProtocol: l.EnableProxyProtocol,
|
||||
HealthCheck: l.HealthCheck,
|
||||
VPCUUID: l.VPCUUID,
|
||||
Name: l.Name,
|
||||
Algorithm: l.Algorithm,
|
||||
ForwardingRules: append([]ForwardingRule(nil), l.ForwardingRules...),
|
||||
DropletIDs: append([]int(nil), l.DropletIDs...),
|
||||
Tag: l.Tag,
|
||||
RedirectHttpToHttps: l.RedirectHttpToHttps,
|
||||
EnableProxyProtocol: l.EnableProxyProtocol,
|
||||
EnableBackendKeepalive: l.EnableBackendKeepalive,
|
||||
HealthCheck: l.HealthCheck,
|
||||
VPCUUID: l.VPCUUID,
|
||||
}
|
||||
|
||||
if l.HealthCheck != nil {
|
||||
|
@ -129,18 +131,19 @@ func (s StickySessions) String() string {
|
|||
|
||||
// LoadBalancerRequest represents the configuration to be applied to an existing or a new load balancer.
|
||||
type LoadBalancerRequest struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Algorithm string `json:"algorithm,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"`
|
||||
HealthCheck *HealthCheck `json:"health_check,omitempty"`
|
||||
StickySessions *StickySessions `json:"sticky_sessions,omitempty"`
|
||||
DropletIDs []int `json:"droplet_ids,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"`
|
||||
EnableProxyProtocol bool `json:"enable_proxy_protocol,omitempty"`
|
||||
VPCUUID string `json:"vpc_uuid,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Algorithm string `json:"algorithm,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"`
|
||||
HealthCheck *HealthCheck `json:"health_check,omitempty"`
|
||||
StickySessions *StickySessions `json:"sticky_sessions,omitempty"`
|
||||
DropletIDs []int `json:"droplet_ids,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"`
|
||||
EnableProxyProtocol bool `json:"enable_proxy_protocol,omitempty"`
|
||||
EnableBackendKeepalive bool `json:"enable_backend_keepalive,omitempty"`
|
||||
VPCUUID string `json:"vpc_uuid,omitempty"`
|
||||
}
|
||||
|
||||
// String creates a human-readable description of a LoadBalancerRequest.
|
||||
|
|
|
@ -829,9 +829,10 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
|
|||
Region: &Region{
|
||||
Slug: "lon1",
|
||||
},
|
||||
RedirectHttpToHttps: true,
|
||||
EnableProxyProtocol: true,
|
||||
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
|
||||
RedirectHttpToHttps: true,
|
||||
EnableProxyProtocol: true,
|
||||
EnableBackendKeepalive: true,
|
||||
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
|
||||
}
|
||||
lb.DropletIDs = make([]int, 1, 2)
|
||||
lb.DropletIDs[0] = 12345
|
||||
|
@ -867,10 +868,11 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
|
|||
CookieName: "nomnom",
|
||||
CookieTtlSeconds: 32,
|
||||
},
|
||||
DropletIDs: []int{12345},
|
||||
RedirectHttpToHttps: true,
|
||||
EnableProxyProtocol: true,
|
||||
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
|
||||
DropletIDs: []int{12345},
|
||||
RedirectHttpToHttps: true,
|
||||
EnableProxyProtocol: true,
|
||||
EnableBackendKeepalive: true,
|
||||
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
|
||||
}
|
||||
|
||||
r := lb.AsRequest()
|
||||
|
|
Loading…
Reference in New Issue