This is an example how to create new bucket with permission to write.
- Docker
- Cloned examples:
git clone [email protected]:influxdata/influxdb-client-swift.git cd Examples/CreateNewBucket
- Start InfluxDB:
docker run --rm \ --name influxdb_v2 \ --detach \ --publish 8086:8086 \ influxdb:latest
- Configure your username, password, organization, bucket and token:
docker run --rm \ --link influxdb_v2 \ curlimages/curl -s -i -X POST http://influxdb_v2:8086/api/v2/setup \ -H 'accept: application/json' \ -d '{"username": "my-user", "password": "my-password", "org": "my-org", "bucket": "my-bucket", "token": "my-token"}'
- Start SwiftCLI by:
docker run --rm \ --link influxdb_v2 \ --privileged \ --interactive \ --tty \ --volume $PWD/../..:/client \ --workdir /client/Examples/CreateNewBucket \ swift:5.7 /bin/bash
- Create a new Bucket by:
swift run create-new-bucket --name new-bucket --org my-org --token my-token --url http://influxdb_v2:8086
The bucket: 'new-bucket' is successfully created.
The following token could be use to read/write:
224axj_OaOOVIaEnSQgx2GTrrt18ZqUATS1I0Hsha3M7Bbbsn_yX9EiXTMnlq5aHz-f8h9iNcRJGd1_ImAD7fA==