orangeqs.juice.orchestration.influxdb2#

InfluxDB2 Utilities.

Module Contents#

Functions#

ensure_secrets_directory_exists

Ensure secrets directory exists.

generate_secrets_file

Generate InfluxDB2 secrets file in the directory if it does not exist.

ensure_data_folders_exist

Ensure Data Folders for influxdb2 storage exist.

retrieve_bucket_id

Retrieve bucket ID from bucket name.

generate_write_token

Generate a write token for the specified bucket.

create_buckets

Create all InfluxDB2 buckets from the configuration.

create_tokens

Create all tokens based on configured services and buckets.

wait_for_started

Wait for the InfluxDB2 instance to start.

API#

orangeqs.juice.orchestration.influxdb2.ensure_secrets_directory_exists(config: orangeqs.juice.orchestration.settings.InfluxDB2InstanceSettings) None#

Ensure secrets directory exists.

Parameters#

  • config (InfluxDB2InstanceSettings): The settings block for the InfluxDB2 Instance.

orangeqs.juice.orchestration.influxdb2.generate_secrets_file(config: orangeqs.juice.orchestration.settings.InfluxDB2InstanceSettings) bool#

Generate InfluxDB2 secrets file in the directory if it does not exist.

Parameters#

  • config (InfluxDB2InstanceSettings): The settings block for the InfluxDB2 Instance.

Returns#

  • bool (False if the file already exists. True if a new file was generated.)

orangeqs.juice.orchestration.influxdb2.ensure_data_folders_exist(config: orangeqs.juice.orchestration.settings.InfluxDB2InstanceSettings) None#

Ensure Data Folders for influxdb2 storage exist.

Parameters#

  • config (InfluxDB2InstanceSettings): The settings block for the InfluxDB2 Instance.

orangeqs.juice.orchestration.influxdb2.retrieve_bucket_id(config: orangeqs.juice.orchestration.settings.InfluxDB2InstanceSettings, bucket_name: str) str#

Retrieve bucket ID from bucket name.

Parameters#

  • config (InfluxDB2InstanceSettings): The settings block for the InfluxDB2 Instance.

  • bucket (str): The bucket name to retrieve bucket id for

Returns#

  • str (The bucket ID corresponding to provided bucket name)

orangeqs.juice.orchestration.influxdb2.generate_write_token(config: orangeqs.juice.orchestration.settings.InfluxDB2InstanceSettings, bucket_name: str) str#

Generate a write token for the specified bucket.

Parameters#

  • config (InfluxDB2InstanceSettings): The settings block for the InfluxDB2 Instance.

  • bucket_name (str): The bucket name to generate a write token for

Returns#

  • (str: The bucket ID corresponding to provided bucket name)

orangeqs.juice.orchestration.influxdb2.create_buckets(config: orangeqs.juice.orchestration.settings.InfluxDB2InstanceSettings) None#

Create all InfluxDB2 buckets from the configuration.

This will create or update buckets based on the configuration provided in config.buckets.

  • If a bucket already exists with the same name it will be updated with the specified retention and description.

  • If a bucket does not exist, it will be created.

Parameters#

  • config (InfluxDB2InstanceSettings): The settings block for the InfluxDB2 Instance.

orangeqs.juice.orchestration.influxdb2.create_tokens(config: orangeqs.juice.orchestration.settings.OrchestrationSettings) None#

Create all tokens based on configured services and buckets.

  • If the token already exists with the required permissions, it will not be recreated.

  • If the token exists but does not have the required permissions, it will be deleted and recreated.

  • If the token does not exist, it will be created with the required permissions.

This assumes that all configured buckets already exist in the InfluxDB2 instance.

Parameters#

  • config (OrchestrationSettings): The configuration to read information from.

orangeqs.juice.orchestration.influxdb2.wait_for_started(config: orangeqs.juice.orchestration.settings.InfluxDB2InstanceSettings, timeout: int = 30) None#

Wait for the InfluxDB2 instance to start.

Parameters#

  • config (InfluxDB2InstanceSettings): The settings block for the InfluxDB2 Instance.

  • timeout (int, optional): The maximum time to wait for the instance to start, in seconds. Default is 30 seconds.