Class: Morpheus::MonitoringAppsInterface

Inherits:
APIClient
  • Object
show all
Defined in:
lib/morpheus/api/monitoring_apps_interface.rb

Instance Method Summary collapse

Instance Method Details

#create(payload) ⇒ Object



20
21
22
23
24
25
# File 'lib/morpheus/api/monitoring_apps_interface.rb', line 20

def create(payload)
  url = "#{@base_url}/api/monitoring/apps"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#destroy(id, payload = {}) ⇒ Object



34
35
36
37
38
39
# File 'lib/morpheus/api/monitoring_apps_interface.rb', line 34

def destroy(id, payload={})
  url = "#{@base_url}/api/monitoring/apps/#{id}"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :delete, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#get(id, params = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/morpheus/api/monitoring_apps_interface.rb', line 5

def get(id, params={})
  raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
  url = "#{@base_url}/api/monitoring/apps/#{id}"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#list(params = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/morpheus/api/monitoring_apps_interface.rb', line 13

def list(params={})
  url = "#{@base_url}/api/monitoring/apps"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#mute(id, payload = {}) ⇒ Object



41
42
43
44
45
46
# File 'lib/morpheus/api/monitoring_apps_interface.rb', line 41

def mute(id, payload={})
  url = "#{@base_url}/api/monitoring/apps/#{id}/mute"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#mute_all(payload = {}) ⇒ Object



48
49
50
51
52
53
# File 'lib/morpheus/api/monitoring_apps_interface.rb', line 48

def mute_all(payload={})
  url = "#{@base_url}/api/monitoring/apps/mute-all"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#quarantine(id, payload = {}) ⇒ Object



55
56
57
# File 'lib/morpheus/api/monitoring_apps_interface.rb', line 55

def quarantine(id, payload={})
  mute(id, payload)
end

#quarantine_all(payload = {}) ⇒ Object



59
60
61
# File 'lib/morpheus/api/monitoring_apps_interface.rb', line 59

def quarantine_all(payload={})
  mute_all(payload)
end

#statistics(id, params = {}) ⇒ Object



63
64
65
66
67
68
# File 'lib/morpheus/api/monitoring_apps_interface.rb', line 63

def statistics(id, params={})
  url = "#{@base_url}/api/monitoring/apps/#{id}/statistics"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#update(id, payload) ⇒ Object



27
28
29
30
31
32
# File 'lib/morpheus/api/monitoring_apps_interface.rb', line 27

def update(id, payload)
  url = "#{@base_url}/api/monitoring/apps/#{id}"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end