Class: InfluxDB2::Client
- Inherits:
-
Object
- Object
- InfluxDB2::Client
- Defined in:
- lib/influxdb2/client/client.rb
Overview
The client is the entry point to HTTP API defined in github.com/influxdata/influxdb/blob/master/http/swagger.yml.
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
Options The configuration options.
Instance Method Summary collapse
-
#close! ⇒ true
Close all connections into InfluxDB 2.
-
#create_delete_api ⇒ DeleteApi
Get the Delete API to delete time series data from InfluxDB.
-
#create_invocable_scripts_api ⇒ InvocableScriptsApi
Create an InvocableScripts API instance.
-
#create_query_api ⇒ QueryApi
Get the Query client.
-
#create_write_api(write_options: InfluxDB2::SYNCHRONOUS, point_settings: InfluxDB2::DEFAULT_POINT_SETTINGS) ⇒ WriteApi
Write time series data into InfluxDB thought WriteApi.
-
#health ⇒ HealthCheck
deprecated
Deprecated.
Use ‘ping` instead
-
#initialize(url, token, options = nil) ⇒ Client
constructor
Instantiate a new InfluxDB client.
-
#ping ⇒ Ping
deprecated
Deprecated.
Use ‘ping` instead
Constructor Details
#initialize(url, token, options = nil) ⇒ Client
Instantiate a new InfluxDB client.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/influxdb2/client/client.rb', line 54 def initialize(url, token, = nil) @auto_closeable = [] = ? .dup : {} [:url] = url if url.is_a? String [:token] = token if token.is_a? String [:logger] = [:logger].nil? ? DefaultApi.create_logger : [:logger] @closed = false at_exit { close! } end |
Instance Attribute Details
#options ⇒ Hash (readonly)
Returns options The configuration options.
27 28 29 |
# File 'lib/influxdb2/client/client.rb', line 27 def end |
Instance Method Details
#close! ⇒ true
Close all connections into InfluxDB 2.
114 115 116 117 118 |
# File 'lib/influxdb2/client/client.rb', line 114 def close! @closed = true @auto_closeable.each(&:close!) true end |
#create_delete_api ⇒ DeleteApi
Get the Delete API to delete time series data from InfluxDB.
84 85 86 |
# File 'lib/influxdb2/client/client.rb', line 84 def create_delete_api DeleteApi.new(options: ) end |
#create_invocable_scripts_api ⇒ InvocableScriptsApi
Create an InvocableScripts API instance.
91 92 93 |
# File 'lib/influxdb2/client/client.rb', line 91 def create_invocable_scripts_api InvocableScriptsApi.new(options: ) end |
#create_query_api ⇒ QueryApi
Get the Query client.
77 78 79 |
# File 'lib/influxdb2/client/client.rb', line 77 def create_query_api QueryApi.new(options: ) end |
#create_write_api(write_options: InfluxDB2::SYNCHRONOUS, point_settings: InfluxDB2::DEFAULT_POINT_SETTINGS) ⇒ WriteApi
Write time series data into InfluxDB thought WriteApi.
68 69 70 71 72 |
# File 'lib/influxdb2/client/client.rb', line 68 def create_write_api(write_options: InfluxDB2::SYNCHRONOUS, point_settings: InfluxDB2::DEFAULT_POINT_SETTINGS) write_api = WriteApi.new(options: , write_options: , point_settings: point_settings) @auto_closeable.push(write_api) write_api end |
#health ⇒ HealthCheck
Use ‘ping` instead
Get the health of an instance.
99 100 101 |
# File 'lib/influxdb2/client/client.rb', line 99 def health HealthApi.new(options: ).health end |
#ping ⇒ Ping
Use ‘ping` instead
Checks the status of InfluxDB instance and version of InfluxDB.
107 108 109 |
# File 'lib/influxdb2/client/client.rb', line 107 def ping PingApi.new(options: ).ping end |