Class: Morpheus::MonitoringChecksInterface

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

Instance Method Summary collapse

Methods inherited from APIClient

#account_groups, #accounts, #apps, #archive_buckets, #archive_files, #auth, #blueprints, #cloud_datastores, #cloud_folders, #cloud_policies, #cloud_resource_pools, #clouds, #clusters, #containers, #custom_instance_types, #cypher, #dashboard, #default_content_type, #deploy, #deployments, #dry, #dry_run, #environments, #execute, #execute_schedules, #execution_request, #file_copy_request, #group_policies, #groups, #image_builder, #inspect, #instance_types, #instances, #key_pairs, #library_compute_type_layouts, #library_container_scripts, #library_container_templates, #library_container_types, #library_container_upgrades, #library_instance_types, #library_layouts, #license, #load_balancers, #logged_in?, #login, #logout, #logs, #monitoring, #network_domain_records, #network_domains, #network_groups, #network_pool_ips, #network_pool_servers, #network_pools, #network_proxies, #network_services, #network_subnet_types, #network_subnets, #network_types, #networks, #old_cypher, #option_type_lists, #option_types, #options, #packages, #policies, #power_schedules, #processes, #provision_types, #refresh_token, #reports, #roles, #security_group_rules, #security_groups, #server_types, #servers, #service_plans, #set_ssl_verification_enabled, #setopts, #setup, #ssl_verification_enabled?, #storage_providers, #task_sets, #tasks, #to_s, #url, #user_groups, #user_settings, #user_sources, #users, #virtual_images, #whoami, #wiki, #withopts

Constructor Details

#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ MonitoringChecksInterface

Returns a new instance of MonitoringChecksInterface.



4
5
6
7
8
9
# File 'lib/morpheus/api/monitoring_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

#create(payload) ⇒ Object



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

def create(payload)
  url = "#{@base_url}/api/monitoring/checks"
  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) ⇒ Object



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

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/monitoring_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



85
86
87
88
89
90
# File 'lib/morpheus/api/monitoring_checks_interface.rb', line 85

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



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

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/monitoring_checks_interface.rb', line 19

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

#list_check_types(options = {}) ⇒ Object



78
79
80
81
82
83
# File 'lib/morpheus/api/monitoring_checks_interface.rb', line 78

def list_check_types(options={})
  url = "#{@base_url}/api/monitoring/check-types"
  headers = { :params => options, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

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



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

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

#quarantine_all(options = {}) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/morpheus/api/monitoring_checks_interface.rb', line 56

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

#statistics(id) ⇒ Object



71
72
73
74
75
76
# File 'lib/morpheus/api/monitoring_checks_interface.rb', line 71

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



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

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