Class: Diplomat::Datacenter
- Inherits:
-
RestClient
- Object
- RestClient
- Diplomat::Datacenter
- Defined in:
- lib/diplomat/datacenter.rb
Overview
Methods for interacting with the Consul dataceneter API endpoint
Instance Method Summary collapse
-
#get(meta = nil) ⇒ OpenStruct
Get an array of all avaliable datacenters accessible by the local consul agent.
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(meta = nil) ⇒ OpenStruct
Get an array of all avaliable datacenters accessible by the local consul agent
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/diplomat/datacenter.rb', line 9 def get( = nil) url = ['/v1/catalog/datacenters'] ret = @conn.get concat_url url if && ret.headers [:index] = ret.headers['x-consul-index'] [:knownleader] = ret.headers['x-consul-knownleader'] [:lastcontact] = ret.headers['x-consul-lastcontact'] end JSON.parse(ret.body) end |