Class: Puppet::Provider::InfluxdbSetup::InfluxdbSetup
- Inherits:
-
ResourceApi::SimpleProvider
- Object
- ResourceApi::SimpleProvider
- Puppet::Provider::InfluxdbSetup::InfluxdbSetup
show all
- Includes:
- PuppetX::Puppetlabs::PuppetlabsInfluxdb
- Defined in:
- lib/puppet/provider/influxdb_setup/influxdb_setup.rb
Overview
Implementation for performing initial setup of InfluxDB using the Resource API.
Instance Attribute Summary
#auth, #bucket_hash, #dbrp_hash, #label_hash, #telegraf_hash, #user_map
Instance Method Summary
collapse
#get_bucket_info, #get_dbrp_info, #get_label_info, #get_org_info, #get_telegraf_info, #get_user_info, #id_from_name, #influx_delete, #influx_get, #influx_patch, #influx_post, #influx_put, #influx_setup, #init_attrs, #init_auth, #name_from_id, #process_links
Constructor Details
Returns a new instance of InfluxdbSetup.
9
10
11
12
|
# File 'lib/puppet/provider/influxdb_setup/influxdb_setup.rb', line 9
def initialize
@canonicalized_resources = []
super
end
|
Instance Method Details
#canonicalize(_context, resources) ⇒ Object
14
15
16
17
|
# File 'lib/puppet/provider/influxdb_setup/influxdb_setup.rb', line 14
def canonicalize(_context, resources)
init_attrs(resources)
resources
end
|
#create(context, name, should) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/puppet/provider/influxdb_setup/influxdb_setup.rb', line 30
def create(context, name, should)
context.debug("Creating '#{name}' with #{should.inspect}")
body = {
bucket: should[:bucket],
org: should[:org],
username: should[:username],
password: should[:password].unwrap,
}
response = influx_post('/api/v2/setup', JSON.dump(body))
File.write(should[:token_file], response['auth']['token'])
end
|
#delete(context, _name) ⇒ Object
46
47
48
|
# File 'lib/puppet/provider/influxdb_setup/influxdb_setup.rb', line 46
def delete(context, _name)
context.warning('Unable to delete setup resource')
end
|
#get(_context) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/puppet/provider/influxdb_setup/influxdb_setup.rb', line 19
def get(_context)
response = influx_get('/api/v2/setup')
[
{
name: @host,
use_ssl: @use_ssl,
ensure: response['allowed'] == true ? 'absent' : 'present',
},
]
end
|
#update(context, _name, _should) ⇒ Object
42
43
44
|
# File 'lib/puppet/provider/influxdb_setup/influxdb_setup.rb', line 42
def update(context, _name, _should)
context.warning('Unable to update setup resource')
end
|