Sha256: 4b1ac0cd9663d8f6e57a075404a9d98ace352da7ec26af1a35dbb8c7e8ea0620

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

require_relative 'base'

module Consul
  module Client
    class Status
      include Consul::Client::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

1 entries across 1 versions & 1 rubygems

Version Path
consul-ruby-client-0.0.2 lib/consul/client/status.rb