tobiasschuerg / InfluxDB-Client-for-Arduino

Simple library for sending measurements to an InfluxDB with a single network request. Supports ESP8266 and ESP32.
MIT License
372 stars 92 forks source link

Support Create Organisation (influxDB v2) #224

Open CoolZeroNL opened 7 months ago

CoolZeroNL commented 7 months ago

Proposal: Create (delete?, find ?) organisation the same way now buckets can be created.

Current behavior: not supported

Desired behavior: able to create a organisation if it not exist, the same way now buckets can be created it it does not exist yet.

offcource the API token needs to have the scope: --write-orgs | Grant permission to create and update organizations

API docs: https://docs.influxdata.com/influxdb/v2/api/#operation/PostOrgs

Scope docs: https://docs.influxdata.com/influxdb/cloud/reference/cli/influx/auth/create/

Alternatives considered: setting up now my own http client to do the api call. it would be nice to use it out of the box with the client.

Use case: I dont want manual create a new organisations. i want to to isolate the data by organsation (endusers can only see org level). So I want to set the org, bucket, token through the ESP, if the organisation and/or bucket doesnt exist it creates them.

In my case, then a cron script will keep track on the server side for each (new) organisation + buckers, it will map/created these also in grafana. This so the endusers are isolated from each other data.

CoolZeroNL commented 7 months ago

I have added the org create, find and delete in my branch: https://github.com/CoolZeroNL/InfluxDB-Client-for-Arduino/tree/add_orgs

and a example file : https://github.com/CoolZeroNL/InfluxDB-Client-for-Arduino/blob/add_orgs/examples/Organisations/Organisations.cpp

this all is working fine.. however i could some help with implenenting this also in the Test files/scripts/Server Mockup.

vlastahajek commented 4 months ago

You can create a PR and we can discuss details in it.