Class: InfluxDB2::API::Client

Inherits:
Object
  • Object
show all
Defined in:
apis/lib/influxdb2/apis/api.rb

Overview

The client is the entry point to management HTTP API defined in github.com/influxdata/influxdb/blob/master/http/swagger.yml.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Client

Initialize client that providing a support for managements APIs.

Examples:

Instantiate a client.

client = InfluxDBClient::Client.new(url: 'https://localhost:8086', token: 'my-token')
api = InfluxDB2::API::Client.new(client)

Parameters:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'apis/lib/influxdb2/apis/api.rb', line 34

def initialize(client)
  configuration = Configuration.new

  uri = URI.parse(client.options[:url])
  # base URL
  configuration.scheme = uri.scheme
  configuration.host = uri.to_s
  # SSL
  configuration.verify_ssl = client.options[:use_ssl].nil? ? true : client.options[:use_ssl]
  # Token
  configuration.api_key_prefix['api_key'] = 'Token'
  configuration.api_key['api_key'] = client.options[:token]
  # Debugging
  configuration.debugging = client.options[:debugging]
  configuration.logger = client.options[:logger]

  @api_client = ApiClient.new(configuration)
  # User Agent
  @api_client.user_agent = "influxdb-client-ruby/#{InfluxDB2::VERSION}"
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



25
26
27
# File 'apis/lib/influxdb2/apis/api.rb', line 25

def api_client
  @api_client
end

Instance Method Details

#create_authorizations_apiInfluxDB2::API::AuthorizationsApi

Create a new instance of AuthorizationsApi.

Returns:



58
59
60
# File 'apis/lib/influxdb2/apis/api.rb', line 58

def create_authorizations_api
  InfluxDB2::API::AuthorizationsApi.new(@api_client)
end

#create_buckets_apiInfluxDB2::API::BucketsApi

Create a new instance of BucketsApi.

Returns:



65
66
67
# File 'apis/lib/influxdb2/apis/api.rb', line 65

def create_buckets_api
  InfluxDB2::API::BucketsApi.new(@api_client)
end

#create_labels_apiInfluxDB2::API::LabelsApi

Create a new instance of LabelsApi.

Returns:



72
73
74
# File 'apis/lib/influxdb2/apis/api.rb', line 72

def create_labels_api
  InfluxDB2::API::LabelsApi.new(@api_client)
end

#create_organizations_apiInfluxDB2::API::OrganizationsApi

Create a new instance of OrganizationsApi.

Returns:



79
80
81
# File 'apis/lib/influxdb2/apis/api.rb', line 79

def create_organizations_api
  InfluxDB2::API::OrganizationsApi.new(@api_client)
end

#create_tasks_apiInfluxDB2::API::TasksApi

Create a new instance of TasksApi.

Returns:



93
94
95
# File 'apis/lib/influxdb2/apis/api.rb', line 93

def create_tasks_api
  InfluxDB2::API::TasksApi.new(@api_client)
end

#create_users_apiInfluxDB2::API::UsersApi

Create a new instance of UsersApi.

Returns:



86
87
88
# File 'apis/lib/influxdb2/apis/api.rb', line 86

def create_users_api
  InfluxDB2::API::UsersApi.new(@api_client)
end