Sha256: b2310ece70be2c77d32cfaf0d9f87ab58b25195bde9295da03ee9de229d8e07b

Contents?: true

Size: 917 Bytes

Versions: 6

Compression:

Stored size: 917 Bytes

Contents

require_relative 'base'

module Consul
  module Client
    class Status < Base

      # Public: This endpoint is used to get the Raft leader for the
      # datacenter in which the agent is running
      #
      # Reference: https://www.consul.io/docs/agent/http/status.html
      #
      # Returns: Address, host:port.
      def leader
        RestClient.get leader_url
      end

      # Public: This endpoint retrieves the Raft peers for the
      # datacenter in which the the agent is running
      #
      # Reference: https://www.consul.io/docs/agent/http/status.html
      #
      # Returns: List of addresses.
      def peers
        RestClient.get peers_url
      end

      def build_url(suffix)
        "#{base_versioned_url}/status/#{suffix}"
      end

      private

      def peers_url
        build_url('peers')
      end

      def leader_url
        build_url('leader')
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
consul-ruby-client-0.0.8 lib/consul/client/status.rb
consul-ruby-client-0.0.7 lib/consul/client/status.rb
consul-ruby-client-0.0.6 lib/consul/client/status.rb
consul-ruby-client-0.0.5 lib/consul/client/status.rb
consul-ruby-client-0.0.4 lib/consul/client/status.rb
consul-ruby-client-0.0.3 lib/consul/client/status.rb