Class: Morpheus::ChecksInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::ChecksInterface
- Defined in:
- lib/morpheus/api/checks_interface.rb
Instance Method Summary collapse
- #destroy(id) ⇒ Object
- #get(id) ⇒ Object
- #get_check_type(check_type_id) ⇒ Object
- #history(id, params = {}) ⇒ Object
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ ChecksInterface
constructor
A new instance of ChecksInterface.
- #list(options = {}) ⇒ Object
- #list_check_types(options = {}) ⇒ Object
- #mute(id, payload = {}) ⇒ Object
- #quarantine(id, options = {}) ⇒ Object
-
#statistics(id) ⇒ Object
def notifications(id) url = "#@base_url/api/monitoring/checks/#id/notifications" headers = { :authorization => "Bearer #@access_token", 'Content-Type' => 'application/json' } opts = :get, url: url, headers: headers execute(opts) end.
-
#update(id, options) ⇒ Object
eh? maye use for rendering form def create(options) url = "#@base_url/api/monitoring/checks/create" headers = { :authorization => "Bearer #@access_token", 'Content-Type' => 'application/json' } payload = options opts = :post, url: url, headers: headers, payload: payload.to_json execute(opts) end.
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ ChecksInterface
Returns a new instance of ChecksInterface.
4 5 6 7 8 9 |
# File 'lib/morpheus/api/checks_interface.rb', line 4 def initialize(access_token, refresh_token,expires_at = nil, base_url=nil) @access_token = access_token @refresh_token = refresh_token @base_url = base_url @expires_at = expires_at end |
Instance Method Details
#destroy(id) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/morpheus/api/checks_interface.rb', line 43 def destroy(id) url = "#{@base_url}/api/monitoring/checks/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :delete, url: url, headers: headers} execute(opts) end |
#get(id) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/morpheus/api/checks_interface.rb', line 11 def get(id) raise "#{self.class}.get() passed a blank id!" if id.to_s == '' url = "#{@base_url}/api/monitoring/checks/#{id}" headers = { params: {}, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#get_check_type(check_type_id) ⇒ Object
90 91 92 93 94 95 |
# File 'lib/morpheus/api/checks_interface.rb', line 90 def get_check_type(check_type_id) url = "#{@base_url}/api/monitoring/check-types/#{check_type_id}" headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#history(id, params = {}) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/morpheus/api/checks_interface.rb', line 62 def history(id, params={}) url = "#{@base_url}/api/monitoring/checks/#{id}/history" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#list(options = {}) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/morpheus/api/checks_interface.rb', line 19 def list(={}) url = "#{@base_url}/api/monitoring/checks" headers = { params: , authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#list_check_types(options = {}) ⇒ Object
83 84 85 86 87 88 |
# File 'lib/morpheus/api/checks_interface.rb', line 83 def list_check_types(={}) url = "#{@base_url}/api/monitoring/check-types" headers = { :params => , :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#mute(id, payload = {}) ⇒ Object
58 59 60 |
# File 'lib/morpheus/api/checks_interface.rb', line 58 def mute(id, payload={}) quarantine(id, payload) end |
#quarantine(id, options = {}) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/morpheus/api/checks_interface.rb', line 50 def quarantine(id, ={}) url = "#{@base_url}/api/monitoring/checks/#{id}/quarantine" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = opts = {method: :put, url: url, headers: headers, payload: payload.to_json} execute(opts) end |
#statistics(id) ⇒ Object
def notifications(id) url = "#@base_url/api/monitoring/checks/#id/notifications" headers = { :authorization => "Bearer #@access_token", 'Content-Type' => 'application/json' } opts = :get, url: url, headers: headers execute(opts) end
76 77 78 79 80 81 |
# File 'lib/morpheus/api/checks_interface.rb', line 76 def statistics(id) url = "#{@base_url}/api/monitoring/checks/#{id}/statistics" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#update(id, options) ⇒ Object
eh? maye use for rendering form def create(options) url = "#@base_url/api/monitoring/checks/create" headers = { :authorization => "Bearer #@access_token", 'Content-Type' => 'application/json' } payload = options opts = :post, url: url, headers: headers, payload: payload.to_json execute(opts) end
35 36 37 38 39 40 41 |
# File 'lib/morpheus/api/checks_interface.rb', line 35 def update(id, ) url = "#{@base_url}/api/monitoring/checks/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = opts = {method: :put, url: url, headers: headers, payload: payload.to_json} execute(opts) end |