LB: Adding tag support for creating LB (#196)
* lb: adding tag support for creating LB * lb: changing Tags to accept array of strings * lb: set CHANGELOG to unreleased
This commit is contained in:
parent
e8cd8327b4
commit
017f7aceec
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## [v1.7.3] - UNRELEASED
|
||||
|
||||
- #196 Expose tag support for creating Load Balancers.
|
||||
|
||||
## [v1.7.2] - 2018-12-04
|
||||
|
||||
- #192 Exposes more options for Kubernetes clusters.
|
||||
|
|
|
@ -26,6 +26,7 @@ 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"`
|
||||
|
@ -39,6 +40,7 @@ type LoadBalancer struct {
|
|||
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"`
|
||||
}
|
||||
|
||||
|
@ -63,6 +65,7 @@ func (l LoadBalancer) AsRequest() *LoadBalancerRequest {
|
|||
RedirectHttpToHttps: l.RedirectHttpToHttps,
|
||||
HealthCheck: l.HealthCheck,
|
||||
}
|
||||
|
||||
if l.HealthCheck != nil {
|
||||
r.HealthCheck = &HealthCheck{}
|
||||
*r.HealthCheck = *l.HealthCheck
|
||||
|
@ -130,6 +133,7 @@ type LoadBalancerRequest struct {
|
|||
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"`
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,8 @@ var lbCreateJSONResponse = `
|
|||
"storage"
|
||||
],
|
||||
"available":true
|
||||
},
|
||||
},
|
||||
"tags": ["my-tag"],
|
||||
"droplet_ids":[
|
||||
2,
|
||||
21
|
||||
|
@ -365,6 +366,7 @@ func TestLoadBalancers_Create(t *testing.T) {
|
|||
CookieTtlSeconds: 5,
|
||||
},
|
||||
Tag: "my-tag",
|
||||
Tags: []string{"my-tag"},
|
||||
DropletIDs: []int{2, 21},
|
||||
RedirectHttpToHttps: true,
|
||||
}
|
||||
|
@ -433,6 +435,7 @@ func TestLoadBalancers_Create(t *testing.T) {
|
|||
Available: true,
|
||||
Features: []string{"private_networking", "backups", "ipv6", "metadata", "storage"},
|
||||
},
|
||||
Tags: []string{"my-tag"},
|
||||
DropletIDs: []int{2, 21},
|
||||
RedirectHttpToHttps: true,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue