Skip to content

Commit

Permalink
commands: Load Balancer updates (digitalocean#1336)
Browse files Browse the repository at this point in the history
* commands: don't require name and region for load balancer updates

Only ID is actually required; requiring name and region is inconvenient.

* commands: deprecate and stop displaying load balancer algorithm

This field has been deprecated on the API side for over a year and it no longer has any effect.
  • Loading branch information
anitgandhi authored Jan 4, 2023
1 parent 111ec1e commit 87d470d
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 20 deletions.
3 changes: 0 additions & 3 deletions commands/displayers/load_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func (lb *LoadBalancer) Cols() []string {
"Name",
"Status",
"Created",
"Algorithm",
"Region",
"Size",
"SizeUnit",
Expand All @@ -61,7 +60,6 @@ func (lb *LoadBalancer) ColMap() map[string]string {
"Name": "Name",
"Status": "Status",
"Created": "Created At",
"Algorithm": "Algorithm",
"Region": "Region",
"Size": "Size",
"SizeUnit": "Size Unit",
Expand Down Expand Up @@ -91,7 +89,6 @@ func (lb *LoadBalancer) KV() []map[string]interface{} {
"Name": l.Name,
"Status": l.Status,
"Created": l.Created,
"Algorithm": l.Algorithm,
"Region": l.Region.Slug,
"VPCUUID": l.VPCUUID,
"Tag": l.Tag,
Expand Down
2 changes: 0 additions & 2 deletions commands/lb_detail.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
- The load balancer's ID
- The load balancer's name
- The load balancer's IP address
- The load balancer's traffic algorithm. Must
be either `round_robin` or `least_connections`
- The current state of the load balancer. This can be `new`, `active`, or `errored`.
- The load balancer's creation date, in ISO8601 combined date and time format.
- The load balancer's forwarding rules. See `doctl compute load-balancer add-forwarding-rules --help` for a list.
Expand Down
8 changes: 4 additions & 4 deletions commands/load_balancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ With the load-balancer command, you can list, create, or delete load balancers,
fmt.Sprintf("The load balancer's size, e.g.: 1. Only one of %s and %s should be used", doctl.ArgSizeUnit, doctl.ArgSizeSlug))
AddStringFlag(cmdRecordCreate, doctl.ArgVPCUUID, "", "", "The UUID of the VPC to create the load balancer in")
AddStringFlag(cmdRecordCreate, doctl.ArgLoadBalancerAlgorithm, "",
"round_robin", "The algorithm to use when traffic is distributed across your Droplets; possible values: `round_robin` or `least_connections`")
"round_robin", "This field has been deprecated. You can no longer specify an algorithm for load balancers.")
AddBoolFlag(cmdRecordCreate, doctl.ArgRedirectHTTPToHTTPS, "", false,
"Redirects HTTP requests to the load balancer on port 80 to HTTPS on port 443")
AddBoolFlag(cmdRecordCreate, doctl.ArgEnableProxyProtocol, "", false,
Expand Down Expand Up @@ -94,16 +94,16 @@ With the load-balancer command, you can list, create, or delete load balancers,
cmdRecordUpdate := CmdBuilder(cmd, RunLoadBalancerUpdate, "update <id>",
"Update a load balancer's configuration", `Use this command to update the configuration of a specified load balancer.`, Writer, aliasOpt("u"))
AddStringFlag(cmdRecordUpdate, doctl.ArgLoadBalancerName, "", "",
"The load balancer's name", requiredOpt())
"The load balancer's name")
AddStringFlag(cmdRecordUpdate, doctl.ArgRegionSlug, "", "",
"The load balancer's region, e.g.: `nyc1`", requiredOpt())
"The load balancer's region, e.g.: `nyc1`")
AddStringFlag(cmdRecordUpdate, doctl.ArgSizeSlug, "", "",
fmt.Sprintf("The load balancer's size, e.g.: `lb-small`. Only one of %s and %s should be used", doctl.ArgSizeSlug, doctl.ArgSizeUnit))
AddIntFlag(cmdRecordUpdate, doctl.ArgSizeUnit, "", 0,
fmt.Sprintf("The load balancer's size, e.g.: 1. Only one of %s and %s should be used", doctl.ArgSizeUnit, doctl.ArgSizeSlug))
AddStringFlag(cmdRecordUpdate, doctl.ArgVPCUUID, "", "", "The UUID of the VPC to create the load balancer in")
AddStringFlag(cmdRecordUpdate, doctl.ArgLoadBalancerAlgorithm, "",
"round_robin", "The algorithm to use when traffic is distributed across your Droplets; possible values: `round_robin` or `least_connections`")
"round_robin", "This field has been deprecated. You can no longer specify an algorithm for load balancers.")
AddBoolFlag(cmdRecordUpdate, doctl.ArgRedirectHTTPToHTTPS, "", false,
"Flag to redirect HTTP requests to the load balancer on port 80 to HTTPS on port 443")
AddBoolFlag(cmdRecordUpdate, doctl.ArgEnableProxyProtocol, "", false,
Expand Down
8 changes: 4 additions & 4 deletions integration/lb_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ var _ = suite("compute/load-balancer/create", func(t *testing.T, when spec.G, it
const (
lbCreateOutput = `
Notice: Load balancer created
ID IP Name Status Created At Algorithm Region Size Size Unit VPC UUID Tag Droplet IDs SSL Sticky Sessions Health Check Forwarding Rules Disable Lets Encrypt DNS Records
4de7ac8b-495b-4884-9a69-1050c6793cd6 example-lb-01 new 2017-02-01T22:22:58Z round_robin nyc3 lb-small <nil> 00000000-0000-4000-8000-000000000000 3164444,3164445 true type:none,cookie_name:,cookie_ttl_seconds:0 protocol:,port:0,path:,check_interval_seconds:0,response_timeout_seconds:0,healthy_threshold:0,unhealthy_threshold:0 true
ID IP Name Status Created At Region Size Size Unit VPC UUID Tag Droplet IDs SSL Sticky Sessions Health Check Forwarding Rules Disable Lets Encrypt DNS Records
4de7ac8b-495b-4884-9a69-1050c6793cd6 example-lb-01 new 2017-02-01T22:22:58Z nyc3 lb-small <nil> 00000000-0000-4000-8000-000000000000 3164444,3164445 true type:none,cookie_name:,cookie_ttl_seconds:0 protocol:,port:0,path:,check_interval_seconds:0,response_timeout_seconds:0,healthy_threshold:0,unhealthy_threshold:0 true
`

lbWaitCreateOutput = `
Notice: Load balancer creation is in progress, waiting for load balancer to become active
Notice: Load balancer created
ID IP Name Status Created At Algorithm Region Size Size Unit VPC UUID Tag Droplet IDs SSL Sticky Sessions Health Check Forwarding Rules Disable Lets Encrypt DNS Records
4de7ac8b-495b-4884-9a69-1050c6793cd6 example-lb-01 active 2017-02-01T22:22:58Z round_robin nyc3 lb-small <nil> 00000000-0000-4000-8000-000000000000 3164444,3164445 true type:none,cookie_name:,cookie_ttl_seconds:0 protocol:,port:0,path:,check_interval_seconds:0,response_timeout_seconds:0,healthy_threshold:0,unhealthy_threshold:0 true
ID IP Name Status Created At Region Size Size Unit VPC UUID Tag Droplet IDs SSL Sticky Sessions Health Check Forwarding Rules Disable Lets Encrypt DNS Records
4de7ac8b-495b-4884-9a69-1050c6793cd6 example-lb-01 active 2017-02-01T22:22:58Z nyc3 lb-small <nil> 00000000-0000-4000-8000-000000000000 3164444,3164445 true type:none,cookie_name:,cookie_ttl_seconds:0 protocol:,port:0,path:,check_interval_seconds:0,response_timeout_seconds:0,healthy_threshold:0,unhealthy_threshold:0 true
`

lbCreateResponse = `
Expand Down
4 changes: 2 additions & 2 deletions integration/lb_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ var _ = suite("compute/load-balancer/get", func(t *testing.T, when spec.G, it sp

const (
lbGetOutput = `
ID IP Name Status Created At Algorithm Region Size Size Unit VPC UUID Tag Droplet IDs SSL Sticky Sessions Health Check Forwarding Rules Disable Lets Encrypt DNS Records
find-lb-id 104.131.186.241 example-lb-01 new 2017-02-01T22:22:58Z round_robin nyc3 lb-small <nil> 00000000-0000-4000-8000-000000000000 3164445 false type:none,cookie_name:,cookie_ttl_seconds:0 protocol:,port:0,path:,check_interval_seconds:0,response_timeout_seconds:0,healthy_threshold:0,unhealthy_threshold:0 false
ID IP Name Status Created At Region Size Size Unit VPC UUID Tag Droplet IDs SSL Sticky Sessions Health Check Forwarding Rules Disable Lets Encrypt DNS Records
find-lb-id 104.131.186.241 example-lb-01 new 2017-02-01T22:22:58Z nyc3 lb-small <nil> 00000000-0000-4000-8000-000000000000 3164445 false type:none,cookie_name:,cookie_ttl_seconds:0 protocol:,port:0,path:,check_interval_seconds:0,response_timeout_seconds:0,healthy_threshold:0,unhealthy_threshold:0 false
`
lbGetResponse = `
{
Expand Down
6 changes: 3 additions & 3 deletions integration/lb_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ var _ = suite("compute/load-balancer/list", func(t *testing.T, when spec.G, it s

const (
lbListOutput = `
ID IP Name Status Created At Algorithm Region Size Size Unit VPC UUID Tag Droplet IDs SSL Sticky Sessions Health Check Forwarding Rules Disable Lets Encrypt DNS Records
lb-one 104.131.186.241 example-lb-01 new 2017-02-01T22:22:58Z round_robin venus3 lb-small <nil> 00000000-0000-4000-8000-000000000000 3164444 false type:none,cookie_name:,cookie_ttl_seconds:0 protocol:http,port:80,path:/,check_interval_seconds:10,response_timeout_seconds:5,healthy_threshold:5,unhealthy_threshold:3 entry_protocol:http,entry_port:80,target_protocol:http,target_port:80,certificate_id:,tls_passthrough:false true
lb-two 104.131.188.204 example-lb-02 new 2017-02-01T20:44:58Z round_robin mars1 lb-medium <nil> 00000000-0000-4000-8000-000000000000 3164445 false type:none,cookie_name:,cookie_ttl_seconds:0 protocol:http,port:80,path:/,check_interval_seconds:10,response_timeout_seconds:5,healthy_threshold:5,unhealthy_threshold:3 entry_protocol:http,entry_port:80,target_protocol:http,target_port:80,certificate_id:,tls_passthrough:false false
ID IP Name Status Created At Region Size Size Unit VPC UUID Tag Droplet IDs SSL Sticky Sessions Health Check Forwarding Rules Disable Lets Encrypt DNS Records
lb-one 104.131.186.241 example-lb-01 new 2017-02-01T22:22:58Z venus3 lb-small <nil> 00000000-0000-4000-8000-000000000000 3164444 false type:none,cookie_name:,cookie_ttl_seconds:0 protocol:http,port:80,path:/,check_interval_seconds:10,response_timeout_seconds:5,healthy_threshold:5,unhealthy_threshold:3 entry_protocol:http,entry_port:80,target_protocol:http,target_port:80,certificate_id:,tls_passthrough:false true
lb-two 104.131.188.204 example-lb-02 new 2017-02-01T20:44:58Z mars1 lb-medium <nil> 00000000-0000-4000-8000-000000000000 3164445 false type:none,cookie_name:,cookie_ttl_seconds:0 protocol:http,port:80,path:/,check_interval_seconds:10,response_timeout_seconds:5,healthy_threshold:5,unhealthy_threshold:3 entry_protocol:http,entry_port:80,target_protocol:http,target_port:80,certificate_id:,tls_passthrough:false false
`
lbListResponse = `
{
Expand Down
4 changes: 2 additions & 2 deletions integration/projects_resources_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ IP Region Droplet ID Droplet Name Project ID
}
`
projectsResourcesGetLoadbalancerOutput = `
ID IP Name Status Created At Algorithm Region Size Size Unit VPC UUID Tag Droplet IDs SSL Sticky Sessions Health Check Forwarding Rules Disable Lets Encrypt DNS Records
4de7ac8b-495b-4884-9a69-1050c6793cd6 104.131.186.241 example-lb-01 new 2017-02-01T22:22:58Z round_robin nyc3 lb-small <nil> 00000000-0000-4000-8000-000000000000 3164445 false type:none,cookie_name:,cookie_ttl_seconds:0 protocol:,port:0,path:,check_interval_seconds:0,response_timeout_seconds:0,healthy_threshold:0,unhealthy_threshold:0 entry_protocol:https,entry_port:444,target_protocol:https,target_port:443,certificate_id:,tls_passthrough:true false
ID IP Name Status Created At Region Size Size Unit VPC UUID Tag Droplet IDs SSL Sticky Sessions Health Check Forwarding Rules Disable Lets Encrypt DNS Records
4de7ac8b-495b-4884-9a69-1050c6793cd6 104.131.186.241 example-lb-01 new 2017-02-01T22:22:58Z nyc3 lb-small <nil> 00000000-0000-4000-8000-000000000000 3164445 false type:none,cookie_name:,cookie_ttl_seconds:0 protocol:,port:0,path:,check_interval_seconds:0,response_timeout_seconds:0,healthy_threshold:0,unhealthy_threshold:0 entry_protocol:https,entry_port:444,target_protocol:https,target_port:443,certificate_id:,tls_passthrough:true false
`
projectsResourcesGetLoadbalancerResponse = `
{
Expand Down

0 comments on commit 87d470d

Please sign in to comment.