How to use the @influxdata/influxdb-client-apis.SetupAPI function in @influxdata/influxdb-client-apis

To help you get started, we’ve selected a few @influxdata/influxdb-client-apis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github influxdata / influxdb / e2e / src / utils / influxUtils.js View on Github external
const setupUserRest = async(user) => {

    const setupAPI = new SetupAPI(new InfluxDB(__config.influx_url));

    setupAPI.getSetup().then(async ({allowed}) => {

        let body = {org: user.org, bucket: user.bucket, username: user.username, password: user.password };

        if(user.token){
            body.token = user.token;
        }

        if(allowed){
            await setupAPI.postSetup({
                body: body,
            });
            console.log(`--- Setup user ${user.username} at ${__config.influx_url} success ---`)
        }else{
          console.error(`--- Failed to setup user ${user.username} at ${__config.influx_url} ---`);