Class: Diplomat::Nodes
- Inherits:
-
RestClient
- Object
- RestClient
- Diplomat::Nodes
- Defined in:
- lib/diplomat/nodes.rb
Overview
Methods for interacting with the Consul nodes API endpoint
Instance Method Summary collapse
-
#get ⇒ OpenStruct
deprecated
Deprecated.
Please use Diplomat::Node instead.
- #get_all(options = nil) ⇒ Object
Methods inherited from RestClient
access_method?, #concat_url, #initialize, method_missing, respond_to?, respond_to_missing?, #use_named_parameter
Constructor Details
This class inherits a constructor from Diplomat::RestClient
Instance Method Details
#get ⇒ OpenStruct
Deprecated.
Please use Diplomat::Node instead.
Get all nodes
10 11 12 13 |
# File 'lib/diplomat/nodes.rb', line 10 def get ret = @conn.get '/v1/catalog/nodes' JSON.parse(ret.body) end |
#get_all(options = nil) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/diplomat/nodes.rb', line 15 def get_all( = nil) url = ['/v1/catalog/nodes'] url << use_named_parameter('dc', [:dc]) if && [:dc] ret = @conn.get concat_url url JSON.parse(ret.body).map { |service| OpenStruct.new service } rescue Faraday::ClientError raise Diplomat::PathNotFound end |