Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement load-balancer cmd. #193

Merged
merged 2 commits into from
Feb 23, 2017
Merged

Implement load-balancer cmd. #193

merged 2 commits into from
Feb 23, 2017

Conversation

viola
Copy link
Contributor

@viola viola commented Feb 23, 2017

This change set implements load-balancer commands.

Load Balancer commands

$ doctl compute load-balancer --help
load-balancer is used to access load-balancer commands

Usage:
  doctl compute load-balancer [command]

Available Commands:
  get                     get load balancer
  create                  create load balancer
  update                  update load balancer
  list                    list load balancers
  delete                  delete load balancer
  add-droplets            add droplets to the load balancer
  remove-droplets         remove droplets from the load balancer
  add-forwarding-rules    add forwarding rules to the load balancer
  remove-forwarding-rules remove forwarding rules from the load balancer

Get load balancer load-balancer get <id>

get load balancer

Usage:
  doctl compute load-balancer get <id> [flags]

Aliases:
  get, g
$ doctl compute load-balancer get 188b572b-590d-4824-b16f-2f655f56e20c
ID                                      IP                Name             Status    Created At              Algorithm      Region    Tag    Droplet IDs    SSL      Sticky Sessions                                Health Check                                                                                                                             Forwarding Rules
188b572b-590d-4824-b16f-2f655f56e20c    138.197.228.96    my-awesome-lb    active    2017-02-21T17:47:08Z    round_robin    nyc1                            false    type:none,cookie_name:,cookie_ttl_seconds:0    protocol:http,port:80,path:/index.html,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 entry_protocol:tcp,entry_port:3306,target_protocol:tcp,target_port:3306,certificate_id:,tls_passthrough:false

List load balancer(s) load-balancer list

list load balancers

Usage:
  doctl compute load-balancer list [flags]

Aliases:
  list, ls
$ doctl compute load-balancer ls
ID                                      IP                 Name             Status    Created At              Algorithm            Region    Tag    Droplet IDs    SSL      Sticky Sessions                                Health Check                                                                                                                             Forwarding Rules
188b572b-590d-4824-b16f-2f655f56e20c    138.197.228.96     my-awesome-lb    active    2017-02-21T17:47:08Z    round_robin          nyc1                            false    type:none,cookie_name:,cookie_ttl_seconds:0    protocol:http,port:80,path:/index.html,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 entry_protocol:tcp,entry_port:3306,target_protocol:tcp,target_port:3306,certificate_id:,tls_passthrough:false
c522ef4e-afb4-4dbb-b2a3-57b5c03be3dd    159.203.154.208    new-lb           active    2017-02-16T17:14:17Z    round_robin          nyc2                            true     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 entry_protocol:tcp,entry_port:3306,target_protocol:tcp,target_port:3306,certificate_id:,tls_passthrough:false
24568841-8b63-4f63-bd68-7f40184276a7    45.55.106.130      v-i-o-l-a        active    2017-02-16T17:13:38Z    least_connections    nyc1             39836673       true     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

Create load balancer load-balancer create

create load balancer

Usage:
  doctl compute load-balancer create [flags]

Aliases:
  create, c


Flags:
      --algorithm string          load balancing algorithm, possible values: round_robin or least_connections (default "round_robin")
      --droplet-ids value         comma-separated list of droplet IDs, example value: 12,33 (default [])
      --forwarding-rules string   comma-separated key:value list, example value: entry_protocol:tcp,entry_port:3306,target_protocol:tcp,target_port:3306, use quoted string of space-separated values for multiple rules
      --health-check string       comma-separated key:value list, example value: protocol:http,port:80,path:/index.html,check_interval_seconds:10,response_timeout_seconds:5,healthy_threshold:5,unhealthy_threshold:3
      --name string               load balancer name (required)
      --redirect-http-to-https    flag to redirect HTTP requests to the load balancer on port 80 to HTTPS on port 443
      --region string             load balancer region location, example value: nyc1 (required)
      --sticky-sessions string    comma-separated key:value list, example value: type:cookies,cookie_name:DO-LB,cookie_ttl_seconds:5
      --tag-name string           droplet tag name
$ doctl compute load-balancer create --name lb-1 --region nyc1 --algorithm least_connections --sticky-sessions type:none --forwarding-rules entry_protocol:http,entry_port:80,target_protocol:http,target_port:80
ID                                      IP    Name    Status    Created At              Algorithm            Region    Tag    Droplet IDs    SSL      Sticky Sessions                                Health Check                                                                                                                   Forwarding Rules
86622eba-f055-439e-b5de-fb4580205463          lb-1    new       2017-02-23T18:34:45Z    least_connections    nyc1                            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

Update load balancer load-balancer update <id>

update load balancer

Usage:
  doctl compute load-balancer update <id> [flags]

Aliases:
  update, u


Flags:
      --algorithm string          load balancing algorithm, possible values: round_robin or least_connections (default "round_robin")
      --droplet-ids value         comma-separated list of droplet IDs, example value: 12,33 (default [])
      --forwarding-rules string   comma-separated key:value list, example value: entry_protocol:tcp,entry_port:3306,target_protocol:tcp,target_port:3306, use quoted string of space-separated values for multiple rules
      --health-check string       comma-separated key:value list, example value: protocol:http,port:80,path:/index.html,check_interval_seconds:10,response_timeout_seconds:5,healthy_threshold:5,unhealthy_threshold:3
      --name string               load balancer name (required)
      --redirect-http-to-https    flag to redirect HTTP requests to the load balancer on port 80 to HTTPS on port 443
      --region string             load balancer region location, example value: nyc1 (required)
      --sticky-sessions string    comma-separated key:value list, example value, example value: type:cookies,cookie_name:DO-LB,cookie_ttl_seconds:5
      --tag-name string           droplet tag name
$ doctl compute load-balancer update 86622eba-f055-439e-b5de-fb4580205463 --name lb-one --region nyc1 --algorithm round_robin --sticky-sessions type:cookies,cookie_name:DO-LB,cookie_ttl_seconds:5 --forwarding-rules entry_protocol:http,entry_port:80,target_protocol:http,target_port:80 --health-check protocol:http,port:80,path:/index.html,check_interval_seconds:10,response_timeout_seconds:5,healthy_threshold:5,unhealthy_threshold:3
ID                                      IP                Name      Status    Created At              Algorithm      Region    Tag    Droplet IDs    SSL      Sticky Sessions                                        Health Check                                                                                                                             Forwarding Rules
86622eba-f055-439e-b5de-fb4580205463    138.197.224.45    lb-one    active    2017-02-23T18:34:45Z    round_robin    nyc1                            false    type:cookies,cookie_name:DO-LB,cookie_ttl_seconds:5    protocol:http,port:80,path:/index.html,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

Delete load balancer load-balancer delete <id>

delete load balancer

Usage:
  doctl compute load-balancer delete <id> [flags]

Aliases:
  delete, d, rm
$ doctl compute load-balancer delete c522ef4e-afb4-4dbb-b2a3-57b5c03be3dd
Warning: Are you sure you want to delete this load balancer (y/N) ? y

Add droplets to the load balancer load-balancer add-droplets <id>

add droplets to the load balancer

Usage:
  doctl compute load-balancer add-droplets <id> [flags]

Flags:
      --droplet-ids value   comma-separated list of droplet IDs, example valus: 12,33 (default [])
$ doctl compute load-balancer add-droplets 86622eba-f055-439e-b5de-fb4580205463 --droplet-ids 39836673,39827769
$ doctl compute load-balancer get 86622eba-f055-439e-b5de-fb4580205463
ID                                      IP                Name      Status    Created At              Algorithm      Region    Tag    Droplet IDs          SSL      Sticky Sessions                                        Health Check                                                                                                                             Forwarding Rules
86622eba-f055-439e-b5de-fb4580205463    138.197.224.45    lb-one    active    2017-02-23T18:34:45Z    round_robin    nyc1             39827769,39836673    false    type:cookies,cookie_name:DO-LB,cookie_ttl_seconds:5    protocol:http,port:80,path:/index.html,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

Remove droplets from the load balancer load-balancer remove-droplets <id>

remove droplets from the load balancer

Usage:
  doctl compute load-balancer remove-droplets <id> [flags]

Flags:
      --droplet-ids value   comma-separated list of droplet IDs, example value: 12,33 (default [])
$ doctl compute load-balancer remove-droplets 86622eba-f055-439e-b5de-fb4580205463 --droplet-ids 39827769
$ doctl compute load-balancer get 86622eba-f055-439e-b5de-fb4580205463
ID                                      IP                Name      Status    Created At              Algorithm      Region    Tag    Droplet IDs    SSL      Sticky Sessions                                        Health Check                                                                                                                             Forwarding Rules
86622eba-f055-439e-b5de-fb4580205463    138.197.224.45    lb-one    active    2017-02-23T18:34:45Z    round_robin    nyc1             39836673       false    type:cookies,cookie_name:DO-LB,cookie_ttl_seconds:5    protocol:http,port:80,path:/index.html,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

Add forwarding rules to the load balancer load-balancer add-forwarding-rules <id>

add forwarding rules to the load balancer

Usage:
  doctl compute load-balancer add-forwarding-rules <id> [flags]

Flags:
      --forwarding-rules string   comma-separated key:value list, example value: entry_protocol:tcp,entry_port:3306,target_protocol:tcp,target_port:3306, use quoted string of space-separated values for multiple rules
$ doctl compute load-balancer add-forwarding-rules 86622eba-f055-439e-b5de-fb4580205463 --forwarding-rules entry_protocol:http,entry_port:8080,target_protocol:http,target_port:8080
$ doctl compute load-balancer get 86622eba-f055-439e-b5de-fb4580205463
ID                                      IP                Name      Status    Created At              Algorithm      Region    Tag    Droplet IDs    SSL      Sticky Sessions                                        Health Check                                                                                                                             Forwarding Rules
86622eba-f055-439e-b5de-fb4580205463    138.197.224.45    lb-one    active    2017-02-23T18:34:45Z    round_robin    nyc1             39836673       false    type:cookies,cookie_name:DO-LB,cookie_ttl_seconds:5    protocol:http,port:80,path:/index.html,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 entry_protocol:http,entry_port:8080,target_protocol:http,target_port:8080,certificate_id:,tls_passthrough:false

Remove forwarding rules from the load balancer load-balancer remove-forwarding-rules <id>

remove forwarding rules from the load balancer

Usage:
  doctl compute load-balancer remove-forwarding-rules <id> [flags]

Flags:
      --forwarding-rules string   comma-separated key:value list, example value: entry_protocol:tcp,entry_port:3306,target_protocol:tcp,target_port:3306, use quoted string of space-separated values for multiple rules
$ doctl compute load-balancer remove-forwarding-rules 86622eba-f055-439e-b5de-fb4580205463 --forwarding-rules entry_protocol:http,entry_port:8080,target_protocol:http,target_port:8080
$ doctl compute load-balancer get 86622eba-f055-439e-b5de-fb4580205463
ID                                      IP                Name      Status    Created At              Algorithm      Region    Tag    Droplet IDs    SSL      Sticky Sessions                                        Health Check                                                                                                                             Forwarding Rules
86622eba-f055-439e-b5de-fb4580205463    138.197.224.45    lb-one    active    2017-02-23T18:34:45Z    round_robin    nyc1             39836673       false    type:cookies,cookie_name:DO-LB,cookie_ttl_seconds:5    protocol:http,port:80,path:/index.html,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

@mauricio
Copy link
Contributor

LGTM 💯

@xmudrii
Copy link
Contributor

xmudrii commented Feb 23, 2017

Looks great to me, great job! 🎉 💯

Maybe you could think about changing ArgTag to use ArgTagName so we stick to some standard. Also, maybe it could be good idea to use ArgTag everywhere instead of ArgTagName.

One more 'maybe maybe' change could be moving ArgDropletIDs under ArgDropletID to keep some readability/consistency, but it's good this way too.

Once again, really great job. 💯

@viola
Copy link
Contributor Author

viola commented Feb 23, 2017

many thx for your review @xmudrii I addressed you feedback @ 3d2ac71

@viola viola merged commit cd35108 into master Feb 23, 2017
@viola viola deleted the add-load-balancer-cmd branch February 23, 2017 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants