InfluxElixir.Admin.Buckets (InfluxElixir v0.1.35)

Copy Markdown View Source

v2 bucket CRUD operations for backwards compatibility.

Delegates to the configured InfluxElixir.Client implementation. Use this module when working with InfluxDB v2 bucket APIs.

Examples

{:ok, conn} = InfluxElixir.Client.Local.start(profile: :v2)

:ok = InfluxElixir.Admin.Buckets.create(conn, "my_bucket")
{:ok, buckets} = InfluxElixir.Admin.Buckets.list(conn)
:ok = InfluxElixir.Admin.Buckets.delete(conn, "my_bucket")

Summary

Functions

Creates a bucket in InfluxDB v2.

Deletes a bucket in InfluxDB v2.

Lists all buckets in InfluxDB v2.

Functions

create(connection, name, opts \\ [])

@spec create(InfluxElixir.Client.connection(), binary(), keyword()) ::
  :ok | {:error, term()}

Creates a bucket in InfluxDB v2.

Parameters

  • connection - a client connection term
  • name - the bucket name to create
  • opts - optional keyword list:
    • :retention - retention in seconds (default 0, no expiry). InfluxDB 2 refuses anything between 1 and 3599 with a 500 retention policy duration must be at least 1h0m0s (verified); the bucket lists its rule as "retentionRules" => [%{"type" => "expire", "everySeconds" => n}]
    • :org_id - the org ID; looked up from the connection's :org when omitted

Returns

  • :ok on success
  • {:error, reason} on failure

delete(connection, name)

@spec delete(InfluxElixir.Client.connection(), binary()) :: :ok | {:error, term()}

Deletes a bucket in InfluxDB v2.

Parameters

  • connection - a client connection term
  • name - the bucket name to delete

Returns

  • :ok on success
  • {:error, reason} on failure

list(connection)

@spec list(InfluxElixir.Client.connection()) :: {:ok, [map()]} | {:error, term()}

Lists all buckets in InfluxDB v2.

Parameters

  • connection - a client connection term

Every bucket of the connection's :org, across all of the server's pages.

Returns

  • {:ok, [map()]} on success
  • {:error, reason} on failure