Class: Chef::Knife::RaxClusterList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::RaxClusterList
- Includes:
- RaxClusterBase
- Defined in:
- lib/chef/knife/rax_cluster_list.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#lb_id ⇒ Object
Returns the value of attribute lb_id.
-
#rax_endpoint ⇒ Object
Returns the value of attribute rax_endpoint.
Instance Method Summary collapse
Methods included from RaxClusterBase
#authenticate, included, #make_web_call, #msg_pair, #populate_environment
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
4 5 6 |
# File 'lib/chef/knife/rax_cluster_list.rb', line 4 def headers @headers end |
#lb_id ⇒ Object
Returns the value of attribute lb_id.
4 5 6 |
# File 'lib/chef/knife/rax_cluster_list.rb', line 4 def lb_id @lb_id end |
#rax_endpoint ⇒ Object
Returns the value of attribute rax_endpoint.
4 5 6 |
# File 'lib/chef/knife/rax_cluster_list.rb', line 4 def rax_endpoint @rax_endpoint end |
Instance Method Details
#run ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/chef/knife/rax_cluster_list.rb', line 25 def run lb_auth = authenticate headers = {"x-auth-token" => lb_auth['auth_token'], "content-type" => "application/json"} lb_url = "" lb_auth['lb_urls'].each {|lb| if config[:lb_region].to_s.downcase == lb['region'].to_s.downcase lb_url = lb['publicURL'] break end lb_url = lb['publicURL'] } lb_url = lb_url + "/loadbalancers" lb_list = make_web_call("get", lb_url, headers) lb_list = JSON.parse(lb_list.body) lb_list['loadBalancers'].each {|lb| if (lb['name'] =~ /_cluster/i) msg_pair("LB Details for #{lb['name']}", " ") msg_pair("\s\s\s\sLB ID", "#{lb['id']}") msg_pair("\s\s\s\sLB Port", "#{lb['port']}") msg_pair("\s\s\s\sLB Algorithm", "#{lb['algorithm']}") msg_pair("\s\s\s\sLB Protocol", "#{lb['protocol']}") msg_pair("\s\s\s\sLB Node Count", "#{lb['nodeCount']}") ui.msg "\n\n" end } end |