Class: Imperium::Agent

Inherits:
Client
  • Object
show all
Defined in:
lib/imperium/agent.rb

Overview

A client for the Agent API.

Constant Summary

Constants inherited from Client

Client::UNIVERSAL_API_OPTIONS

Instance Attribute Summary

Attributes inherited from Client

#config

Instance Method Summary collapse

Methods inherited from Client

default_client, inherited, #initialize, #path_prefix, reset_default_client, reset_default_clients

Constructor Details

This class inherits a constructor from Imperium::Client

Instance Method Details

#deregister_service(service_or_id) ⇒ Object

Deregister a service with the agent.

Parameters:

  • service_or_id (Service, String)

    The object or id representing the service to be removed from the services registry.

See Also:



14
15
16
17
# File 'lib/imperium/agent.rb', line 14

def deregister_service(service_or_id)
  id = (service_or_id.is_a?(Service) ? service_or_id.id : service_or_id)
  Response.new(@http_client.put(prefix_path("service/deregister/#{id}"), ''))
end

#list_checksAgentListChecksResponse

Retreive a list of all checks registered to the local agent.



23
24
25
26
# File 'lib/imperium/agent.rb', line 23

def list_checks
  response = @http_client.get(prefix_path('checks'))
  AgentListChecksResponse.new(response)
end

#list_servicesAgentListServicesResponse

Retreive a list of all services registered to the local agent.



32
33
34
35
# File 'lib/imperium/agent.rb', line 32

def list_services
  response = @http_client.get(prefix_path('services'))
  AgentListServicesResponse.new(response)
end

#register_service(service) ⇒ Object

Register a new service with the agent.

Parameters:

  • service (Serivce)

    A Service object containing the data to use for registration

See Also:



43
44
45
# File 'lib/imperium/agent.rb', line 43

def register_service(service)
  Response.new(@http_client.put(prefix_path('service/register'), service.registration_data))
end