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