Class: Bosh::Monitor::Director

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/monitor/director.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Director

Returns a new instance of Director.



4
5
6
7
8
# File 'lib/bosh/monitor/director.rb', line 4

def initialize(options)
  @endpoint = options["endpoint"].to_s
  @user     = options["user"].to_s
  @password = options["password"].to_s
end

Instance Method Details

#get_deployment_vms(name) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bosh/monitor/director.rb', line 23

def get_deployment_vms(name)
  http = perform_request(:get, "/deployments/#{name}/vms")

  body   = http.response
  status = http.response_header.http_status

  if status != "200"
    raise DirectorError, "Cannot get deployment `#{name}' from director at #{http.uri}: #{status} #{body}"
  end

  parse_json(body, Array)
end

#get_deploymentsObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bosh/monitor/director.rb', line 10

def get_deployments
  http = perform_request(:get, "/deployments")

  body   = http.response
  status = http.response_header.http_status

  if status != "200"
    raise DirectorError, "Cannot get deployments from director at #{http.uri}: #{status} #{body}"
  end

  parse_json(body, Array)
end