Class: VarnishRestApiClient::Client
- Inherits:
-
Thor
- Object
- Thor
- VarnishRestApiClient::Client
- Defined in:
- lib/varnish_rest_api_client/client.rb
Instance Method Summary collapse
- #in(backend) ⇒ Object
-
#initialize(*args) ⇒ Client
constructor
alternate use invoke.
- #list(pattern = nil) ⇒ Object
- #out(backend) ⇒ Object
- #show ⇒ Object
Constructor Details
#initialize(*args) ⇒ Client
alternate use invoke
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/varnish_rest_api_client/client.rb', line 15 def initialize(*args) super @nodes = Array.new @use_zookeeper = use_zookeeper if @use_zookeeper @nodes = get_zk_nodes else @nodes = [:varnish] end end |
Instance Method Details
#in(backend) ⇒ Object
32 33 34 |
# File 'lib/varnish_rest_api_client/client.rb', line 32 def in(backend) set_health(backend,"in") end |
#list(pattern = nil) ⇒ Object
42 43 44 45 |
# File 'lib/varnish_rest_api_client/client.rb', line 42 def list(pattern=nil) backends_found = list_backends(pattern) puts backends_found.empty? ? "no backends found for pattern #{pattern}" : backends_found end |
#out(backend) ⇒ Object
27 28 29 |
# File 'lib/varnish_rest_api_client/client.rb', line 27 def out(backend) set_health(backend,"out") end |
#show ⇒ Object
37 38 39 |
# File 'lib/varnish_rest_api_client/client.rb', line 37 def show puts @nodes.join("\n") end |