Class: Morpheus::MonitoringGroupsInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::MonitoringGroupsInterface
- Defined in:
- lib/morpheus/api/monitoring_groups_interface.rb
Instance Method Summary collapse
- #create(payload) ⇒ Object
- #destroy(id, payload = {}) ⇒ Object
- #get(id, params = {}) ⇒ Object
- #history(id, params = {}) ⇒ Object
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ MonitoringGroupsInterface
constructor
A new instance of MonitoringGroupsInterface.
- #list(params = {}) ⇒ Object
- #quarantine(id, payload = {}) ⇒ Object
- #quarantine_all(payload = {}) ⇒ Object
- #statistics(id) ⇒ Object
- #update(id, payload) ⇒ Object
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ MonitoringGroupsInterface
Returns a new instance of MonitoringGroupsInterface.
4 5 6 7 8 9 |
# File 'lib/morpheus/api/monitoring_groups_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
#create(payload) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/morpheus/api/monitoring_groups_interface.rb', line 26 def create(payload) url = "#{@base_url}/api/monitoring/groups" 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
40 41 42 43 44 45 |
# File 'lib/morpheus/api/monitoring_groups_interface.rb', line 40 def destroy(id, payload={}) url = "#{@base_url}/api/monitoring/groups/#{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
11 12 13 14 15 16 17 |
# File 'lib/morpheus/api/monitoring_groups_interface.rb', line 11 def get(id, params={}) raise "#{self.class}.get() passed a blank id!" if id.to_s == '' url = "#{@base_url}/api/monitoring/groups/#{id}" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#history(id, params = {}) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/morpheus/api/monitoring_groups_interface.rb', line 61 def history(id, params={}) url = "#{@base_url}/api/monitoring/groups/#{id}/history" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#list(params = {}) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/morpheus/api/monitoring_groups_interface.rb', line 19 def list(params={}) url = "#{@base_url}/api/monitoring/groups" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#quarantine(id, payload = {}) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/morpheus/api/monitoring_groups_interface.rb', line 47 def quarantine(id, payload={}) url = "#{@base_url}/api/monitoring/groups/#{id}/quarantine" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :put, url: url, headers: headers, payload: payload.to_json} execute(opts) end |
#quarantine_all(payload = {}) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/morpheus/api/monitoring_groups_interface.rb', line 54 def quarantine_all(payload={}) url = "#{@base_url}/api/monitoring/groups/quarantine-all" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :put, url: url, headers: headers, payload: payload.to_json} execute(opts) end |
#statistics(id) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/morpheus/api/monitoring_groups_interface.rb', line 68 def statistics(id) url = "#{@base_url}/api/monitoring/groups/#{id}/statistics" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#update(id, payload) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/morpheus/api/monitoring_groups_interface.rb', line 33 def update(id, payload) url = "#{@base_url}/api/monitoring/groups/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :put, url: url, headers: headers, payload: payload.to_json} execute(opts) end |