Class: Morpheus::LogsInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::LogsInterface
- Defined in:
- lib/morpheus/api/logs_interface.rb
Instance Method Summary collapse
- #container_logs(containers = [], options = {}) ⇒ Object
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ LogsInterface
constructor
A new instance of LogsInterface.
- #server_logs(servers = [], options = {}) ⇒ Object
- #stats ⇒ Object
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ LogsInterface
Returns a new instance of LogsInterface.
5 6 7 8 9 10 |
# File 'lib/morpheus/api/logs_interface.rb', line 5 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
#container_logs(containers = [], options = {}) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/morpheus/api/logs_interface.rb', line 12 def container_logs(containers=[], ={}) url = "#{@base_url}/api/logs" headers = { params: {'containers' => containers}.merge(), authorization: "Bearer #{@access_token}" } response = Morpheus::RestClient.execute(method: :get, url: url, timeout: 30, headers: headers, verify_ssl: false) JSON.parse(response.to_s) end |
#server_logs(servers = [], options = {}) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/morpheus/api/logs_interface.rb', line 20 def server_logs(servers=[], ={}) url = "#{@base_url}/api/logs" headers = { params: {'servers': servers}.merge(), authorization: "Bearer #{@access_token}" } response = Morpheus::RestClient.execute(method: :get, url: url, timeout: 30, headers: headers, verify_ssl: false) JSON.parse(response.to_s) end |
#stats ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/morpheus/api/logs_interface.rb', line 28 def stats() url = "#{@base_url}/api/logs/log-stats" headers = { params: {}, authorization: "Bearer #{@access_token}" } response = Morpheus::RestClient.execute(method: :get, url: url, timeout: 30, headers: headers, verify_ssl: false) JSON.parse(response.to_s) end |