Class: Diplomat::Nodes

Inherits:
RestClient show all
Defined in:
lib/diplomat/nodes.rb

Overview

Methods for interacting with the Consul nodes API endpoint

Instance Method Summary collapse

Methods inherited from RestClient

access_method?, #concat_url, #configuration, #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(options = {}) ⇒ OpenStruct

Deprecated.

Please use Diplomat::Node instead.

Get all nodes

Parameters:

  • options (Hash) (defaults to: {})

    options parameter hash

Returns:

  • (OpenStruct)

    all data associated with the nodes in catalog



13
14
15
16
# File 'lib/diplomat/nodes.rb', line 13

def get(options = {})
  ret = send_get_request(@conn, ['/v1/catalog/nodes'], options)
  JSON.parse(ret.body)
end

#get_all(options = {}) ⇒ Object



18
19
20
21
22
# File 'lib/diplomat/nodes.rb', line 18

def get_all(options = {})
  custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
  ret = send_get_request(@conn, ['/v1/catalog/nodes'], options, custom_params)
  JSON.parse(ret.body).map { |service| OpenStruct.new service }
end