### Setup InfluxDB Instance Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Calls the POST /setup endpoint to perform the initial setup of the InfluxDB instance, including creating the first user, organization, and bucket. This is typically done once upon installation. ```go func (c *Client) PostSetup(ctx context.Context, params *PostSetupAllParams) (*OnboardingResponse, error) ``` -------------------------------- ### FakeClient Setup Method Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/internal/examples Implements the Setup method for FakeClient. This method does nothing and returns nil. ```go func (c *FakeClient) Setup(_ context.Context, _, _, _, _ string, _ int) (*domain.OnboardingResponse, error) ``` -------------------------------- ### Install oapi-codegen Tool Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/domain Install the oapi-codegen tool globally using 'go install'. ```bash go install ./cmd/oapi-codegen/oapi-codegen.go ``` -------------------------------- ### Label Properties Example Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api Shows an example of properties that can be set when creating or updating labels, including color and description. ```go {"color": "ffb3b3", "description": "this is a description"} ``` -------------------------------- ### Install Client Package in GOPATH Mode Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 For GOPATH projects, use 'go get' to install the InfluxDB client. Ensure GO111MODULE is set to 'off'. ```sh go get github.com/influxdata/influxdb-client-go ``` -------------------------------- ### GetSetup Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Checks if the InfluxDB setup is complete. ```APIDOC ## GetSetup ### Description Checks the current setup status of the InfluxDB instance to determine if initial configuration is required. ### Method GET ### Endpoint /api/v2/setup ### Parameters #### Query Parameters - **check** (string) - Optional - Specifies the setup check to perform (e.g., "onboarding"). ### Response #### Success Response (200) - **isOnboarding** (bool) - True if the instance requires onboarding, false otherwise. #### Response Example { "isOnboarding": false } ``` -------------------------------- ### GetReady Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Get the readiness of an instance at startup. ```APIDOC ## GET /ready ### Description Get the readiness of an instance at startup. ### Method GET ### Endpoint /ready ``` -------------------------------- ### Install oapi generator Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Clone the oapi-codegen repository and install the generator. ```bash git clone git@github.com:bonitoo-io/oapi-codegen.git cd oapi-codegen git checkout feat/template_helpers go install ./cmd/oapi-codegen/oapi-codegen.go ``` -------------------------------- ### Get Telegraf Configurations Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a list of all Telegraf configurations. Use this to manage or view your Telegraf setups. ```go func (c *Client) GetTelegrafs(ctx context.Context, params *GetTelegrafsParams) (*Telegrafs, error) ``` -------------------------------- ### Start Task Run Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Calls the POST /tasks/{taskID}/runs endpoint to start a task run, potentially overriding the scheduled execution. This allows for manual triggering of tasks. ```go func (c *Client) PostTasksIDRuns(ctx context.Context, params *PostTasksIDRunsAllParams) (*Run, error) ``` -------------------------------- ### ListStacks Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/domain List installed stacks. This operation retrieves a list of all installed stacks. ```APIDOC ## GET /stacks ### Description List installed stacks. ### Method GET ### Endpoint /stacks ### Parameters #### Query Parameters - **params** (*ListStacksParams) - Required - Parameters for filtering and pagination. ### Response #### Success Response (200) - **Stacks** (*struct { Stacks *[]Stack `json:"stacks,omitempty"` }) - A response object containing a list of installed stacks. #### Response Example { "example": "{\"stacks\": [{\"id\": \"stack_id_1\", \"name\": \"Stack One\"}, {\"id\": \"stack_id_2\", \"name\": \"Stack Two\"}] }" } ``` -------------------------------- ### Get Write Options Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Returns the write-related options configured for the client. ```go func (o *Options) WriteOptions() *write.Options ``` -------------------------------- ### Get TLS Configuration Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/http Returns the current TLS configuration. ```go func (o *Options) TLSConfig() *tls.Config ``` -------------------------------- ### Get HTTP Options Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Retrieves HTTP-related options. ```go func (o *Options) HTTPOptions() *http.Options ``` -------------------------------- ### Define Ready struct Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Represents the readiness status of a service, including start time and status. ```go type Ready struct { Started *time.Time `json:"started,omitempty"` Status *ReadyStatus `json:"status,omitempty"` Up *string `json:"up,omitempty"` } ``` -------------------------------- ### Get Server URL Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/internal/test Returns the base testing URL for the server. ```go func (t *HTTPService) ServerURL() string ``` -------------------------------- ### List Buckets Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Lists all buckets. This function interacts with the GET /buckets endpoint. ```go func (c *Client) GetBuckets(ctx context.Context, params *GetBucketsParams) (*Buckets, error) ``` -------------------------------- ### Get Log Level Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Retrieves the current log level. ```go func (o *Options) LogLevel() uint ``` -------------------------------- ### PostSetup Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Sets up the initial user, organization, and bucket by calling the POST on the /setup endpoint. ```APIDOC ## PostSetup ### Description Sets up the initial user, organization, and bucket. ### Method POST ### Endpoint /setup ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **params** (*PostSetupAllParams) - Required - Parameters for the setup process. ### Request Example ```json { "example": "request body for PostSetup" } ``` ### Response #### Success Response (200) * **OnboardingResponse** - The onboarding response. #### Response Example ```json { "example": "OnboardingResponse example" } ``` ``` -------------------------------- ### RunManually Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api Manually start a run of the task now, overriding the current schedule. ```APIDOC ## RunManually ### Description Manually start a run of the task now, overriding the current schedule. ### Method [Method not specified, likely POST] ### Endpoint [Endpoint not specified] ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **task** (*domain.Task) - Required - The task to run manually. ### Request Example ```json { "id": "task-id-to-run-manually" } ``` ### Response #### Success Response (200) - **domain.Run** - The newly created run object. #### Response Example ```json { "id": "new-run-id", "taskID": "task-id-to-run-manually", "status": "running" } ``` ``` -------------------------------- ### ListStacks Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Lists all installed stacks in the InfluxDB instance. This function corresponds to a GET request on the /stacks endpoint. ```APIDOC ## GET /stacks ### Description List installed stacks. ### Method GET ### Endpoint /stacks ### Parameters #### Query Parameters - **params** (*ListStacksParams) - Required - Parameters for filtering and pagination. ### Response #### Success Response (200) - **Stacks** (*struct { Stacks *[]Stack `json:"stacks,omitempty"` }) - A response object containing a list of installed stacks. #### Response Example ```json { "stacks": [ { "id": "string", "name": "string", "version": "string", "description": "string", "labels": [] } ] } ``` ``` -------------------------------- ### Get Specific Telegraf Configuration Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a specific Telegraf configuration by its ID. Use this to inspect or modify a Telegraf setup. ```go func (c *Client) GetTelegrafsID(ctx context.Context, params *GetTelegrafsIDAllParams) (*Telegraf, error) ``` -------------------------------- ### Get FluxRecord Start Time Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/query Retrieves the inclusive lower time bound of all records in the current table. Returns an empty time.Time if the _start column is not found. ```go func (r *FluxRecord) Start() time.Time ``` -------------------------------- ### GetSetup Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Check if the database has the default user, org, and bucket. ```APIDOC ## GET /setup ### Description Check if database has default user, org, bucket. ### Method GET ### Endpoint /setup ``` -------------------------------- ### PostSetup Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Initializes the InfluxDB instance. This is typically the first step after deployment to set up the system. ```APIDOC ## POST /api/v2/setup ### Description Initializes the InfluxDB instance. ### Method POST ### Endpoint /api/v2/setup #### Request Body - **params** (*PostSetupAllParams) - Required - Parameters for the setup process. ``` -------------------------------- ### PostSetup Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/domain Sets up the initial user, organization, and bucket by calling the POST /setup endpoint. This is typically used during the initial InfluxDB setup process. ```APIDOC ## POST /setup ### Description Set up initial user, org and bucket. ### Method POST ### Endpoint /setup ### Parameters #### Request Body - **params** (*PostSetupAllParams) - Required - Parameters for the initial setup. ### Response #### Success Response (200) - **OnboardingResponse** - The response indicating the success of the onboarding process. ``` -------------------------------- ### Basic InfluxDB Write and Query Example Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Demonstrates writing data points using both full parameters and fluent style, as well as writing raw line protocol. It also shows how to query data back using Flux. ```go package main import ( "context" "fmt" "time" "github.com/influxdata/influxdb-client-go/v2" ) func main() { // Create a new client using an InfluxDB server base URL and an authentication token client := influxdb2.NewClient("http://localhost:8086", "my-token") // Use blocking write client for writes to desired bucket writeAPI := client.WriteAPIBlocking("my-org", "my-bucket") // Create point using full params constructor p := influxdb2.NewPoint("stat", map[string]string{"unit": "temperature"}, map[string]interface{}{"avg": 24.5, "max": 45.0}, time.Now()) // write point immediately writeAPI.WritePoint(context.Background(), p) // Create point using fluent style p = influxdb2.NewPointWithMeasurement("stat"). AddTag("unit", "temperature"). AddField("avg", 23.2). AddField("max", 45.0). SetTime(time.Now()) err := writeAPI.WritePoint(context.Background(), p) if err != nil { panic(err) } // Or write directly line protocol line := fmt.Sprintf("stat,unit=temperature avg=%f,max=%f", 23.5, 45.0) err = writeAPI.WriteRecord(context.Background(), line) if err != nil { panic(err) } // Get query client queryAPI := client.QueryAPI("my-org") // Get parser flux query result result, err := queryAPI.Query(context.Background(), `from(bucket:"my-bucket") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "stat")`) if err == nil { // Use Next() to iterate over query result lines for result.Next() { // Observe when there is new grouping key producing new table if result.TableChanged() { fmt.Printf("table: %s\n", result.TableMetadata().String()) } // read result fmt.Printf("row: %s\n", result.Record().String()) } if result.Err() != nil { fmt.Printf("Query error: %s\n", result.Err().Error()) } } else { panic(err) } // Ensures background processes finishes client.Close() } ``` -------------------------------- ### Get Organizations Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a list of all organizations. This function calls the GET /orgs endpoint. ```go func (c *Client) GetOrgs(ctx context.Context, params *GetOrgsParams) (*Organizations, error) ``` -------------------------------- ### Get Application Name Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Retrieves the application name used in the User-Agent HTTP header. ```go func (o *Options) ApplicationName() string ``` -------------------------------- ### Get Labels Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a list of all labels. This function calls the GET /labels endpoint. ```go func (c *Client) GetLabels(ctx context.Context, params *GetLabelsParams) (*LabelsResponse, error) ``` -------------------------------- ### Write and Query Data with InfluxDB 1.8 Compatibility Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 This example demonstrates how to initialize the InfluxDB client, write a data point, and query data using the compatibility APIs for InfluxDB 1.8. Ensure you provide the correct server URL and authentication credentials. For buckets, use the format 'database/retention-policy'. ```go package main import ( "context" "fmt" "time" "github.com/influxdata/influxdb-client-go/v2" ) func main() { userName := "my-user" password := "my-password" // Create a new client using an InfluxDB server base URL and an authentication token // For authentication token supply a string in the form: "username:password" as a token. Set empty value for an unauthenticated server client := influxdb2.NewClient("http://localhost:8086", fmt.Sprintf("%s:%s",userName, password)) // Get the blocking write client // Supply a string in the form database/retention-policy as a bucket. Skip retention policy for the default one, use just a database name (without the slash character) // Org name is not used writeAPI := client.WriteAPIBlocking("", "test/autogen") // create point using full params constructor p := influxdb2.NewPoint("stat", map[string]string{"unit": "temperature"}, map[string]interface{}{"avg": 24.5, "max": 45}, time.Now()) // Write data err := writeAPI.WritePoint(context.Background(), p) if err != nil { fmt.Printf("Write error: %s\n", err.Error()) } // Get query client. Org name is not used queryAPI := client.QueryAPI("") // Supply string in a form database/retention-policy as a bucket. Skip retention policy for the default one, use just a database name (without the slash character) result, err := queryAPI.Query(context.Background(), `from(bucket:\"test\")|> range(start: -1h) |> filter(fn: (r) => r._measurement == \"stat\")`) if err == nil { for result.Next() { if result.TableChanged() { fmt.Printf("table: %s\n", result.TableMetadata().String()) } fmt.Printf("row: %s\n", result.Record().String()) } if result.Err() != nil { fmt.Printf("Query error: %s\n", result.Err().Error()) } } else { fmt.Printf("Query error: %s\n", err.Error()) } // Close client client.Close() } ``` -------------------------------- ### GetSourcesIDHealth Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/domain Get the health of a source. This method calls the GET /sources/{sourceID}/health endpoint. ```APIDOC ## GET /sources/{sourceID}/health ### Description Get the health of a source. ### Method GET ### Endpoint /sources/{sourceID}/health ### Parameters #### Path Parameters - **sourceID** (string) - Required - The ID of the source. #### Query Parameters - **params** (*GetSourcesIDHealthAllParams) - Required - Parameters for getting the health of a source. ``` -------------------------------- ### FakeClient Ready Method Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/internal/examples Implements the Ready method for FakeClient. This method does nothing and returns true and nil error. ```go func (c *FakeClient) Ready(_ context.Context) (bool, error) ``` -------------------------------- ### Get Variables Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a list of all variables. Use this to manage or view available variables. ```go func (c *Client) GetVariables(ctx context.Context, params *GetVariablesParams) (*Variables, error) ``` -------------------------------- ### IsOnboarding Struct Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Indicates whether an InfluxDB instance has undergone initial setup. ```go type IsOnboarding struct { // If `true`, the InfluxDB instance hasn't had initial setup; // `false` otherwise. Allowed *bool `json:"allowed,omitempty"` } ``` -------------------------------- ### OnboardingRequest Struct Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Defines the request payload for onboarding a new organization and user. Includes fields for bucket, organization, password, retention period, and username. ```go type OnboardingRequest struct { Bucket string `json:"bucket"` Org string `json:"org"` Password *string `json:"password,omitempty"` // Retention period *in nanoseconds* for the new bucket. This key's name has been misleading since OSS 2.0 GA, please transition to use `retentionPeriodSeconds` RetentionPeriodHrs *int `json:"retentionPeriodHrs,omitempty"` RetentionPeriodSeconds *int64 `json:"retentionPeriodSeconds,omitempty"` // Authentication token to set on the initial user. If not specified, the server will generate a token. Token *string `json:"token,omitempty"` Username string `json:"username"` } ``` -------------------------------- ### Get Notification Rules Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a list of all notification rules. This function calls the GET /notificationRules endpoint. ```go func (c *Client) GetNotificationRules(ctx context.Context, params *GetNotificationRulesParams) (*NotificationRules, error) ``` -------------------------------- ### Create HTTP Service Instance Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/http Creates an instance of the HTTP service with the given server URL, authorization token, and HTTP options. ```go func NewService(serverURL, authorization string, httpOptions *Options) Service ``` -------------------------------- ### NewClientWithOptions Function Signature Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Creates a client for connecting to a given server URL with a provided authentication token and custom Options. The server URL should be the InfluxDB server base URL (e.g., http://localhost:8086). The authentication token can be empty for a new InfluxDB server, in which case Setup() will set the token. ```go func NewClientWithOptions(serverURL string, authToken string, options *Options) Client ``` -------------------------------- ### Get Notification Endpoints Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a list of all notification endpoints. This function calls the GET /notificationEndpoints endpoint. ```go func (c *Client) GetNotificationEndpoints(ctx context.Context, params *GetNotificationEndpointsParams) (*NotificationEndpoints, error) ``` -------------------------------- ### Get Health Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves the health status of the InfluxDB instance. This function calls the GET /health endpoint. ```go func (c *Client) GetHealth(ctx context.Context, params *GetHealthParams) (*HealthCheck, error) ``` -------------------------------- ### Client.SetupWithToken Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Sends a request to initialize a new InfluxDB server with user, organization, bucket, data retention period, and a token. It returns details about the newly created entities along with an authorization object. A retention period of zero results in infinite retention. ```APIDOC ## Client.SetupWithToken ### Description Sends a request to initialize a new InfluxDB server with user, organization, bucket, data retention period, and a token. It returns details about the newly created entities along with an authorization object. A retention period of zero results in infinite retention. ### Method func (c Client) SetupWithToken(ctx context.Context, username, password, org, bucket string, retentionPeriodHours int, token string) (*domain.OnboardingResponse, error) ``` -------------------------------- ### Get Organization by ID Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a specific organization by its ID. This function calls the GET /orgs/{orgID} endpoint. ```go func (c *Client) GetOrgsID(ctx context.Context, params *GetOrgsIDAllParams) (*Organization, error) ``` -------------------------------- ### Get Current User Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves information about the currently authenticated user. This function calls the GET /me endpoint. ```go func (c *Client) GetMe(ctx context.Context, params *GetMeParams) (*UserResponse, error) ``` -------------------------------- ### Get Label by ID Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a specific label by its ID. This function calls the GET /labels/{labelID} endpoint. ```go func (c *Client) GetLabelsID(ctx context.Context, params *GetLabelsIDAllParams) (*LabelResponse, error) ``` -------------------------------- ### NewClientWithOptions Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Creates a Client for connecting to a given server URL with a provided authentication token and custom Options. The server URL should be in the format http://localhost:8086. The auth token can be empty if the InfluxDB server has not yet been set up, in which case Setup() can be called to establish the token. ```APIDOC ## NewClientWithOptions ### Description Creates a Client for connecting to a given server URL with a provided authentication token and custom Options. The server URL should be in the format http://localhost:8086. The auth token can be empty if the InfluxDB server has not yet been set up, in which case Setup() can be called to establish the token. ### Method func NewClientWithOptions(serverURL string, authToken string, options *Options) Client ``` -------------------------------- ### Options SetBatchSize Method Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/internal/examples Emulates the SetBatchSize method for Options, accepting a uint and returning a pointer to Options. ```go func (o *Options) SetBatchSize(_ uint) *Options ``` -------------------------------- ### Get Flags Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves the feature flags for the currently authenticated user. This function calls the GET /flags endpoint. ```go func (c *Client) GetFlags(ctx context.Context, params *GetFlagsParams) (*Flags, error) ``` -------------------------------- ### Get TLS Configuration from Options Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/http TLSConfig returns the TLS configuration used for HTTPS connections. ```go func (o *Options) TLSConfig() *tls.Config ``` -------------------------------- ### Flux Query with Parameters Example Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api Example of a Flux query that uses parameters defined in a struct for filtering data. ```flux query:= `from(bucket: "environment") |> range(start: time(v: params.start)) |> filter(fn: (r) => r._measurement == "air") |> filter(fn: (r) => r._field == params.field) |> filter(fn: (r) => r._value > params.value)` ``` -------------------------------- ### Create Bucket Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Calls the POST on /buckets to create a new bucket. Use this function to programmatically set up new data storage buckets. ```go func (c *Client) PostBuckets(ctx context.Context, params *PostBucketsAllParams) (*Bucket, error) ``` -------------------------------- ### Create Organization Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Calls the POST on /orgs to create a new organization. Use to programmatically set up new organizational structures. ```go func (c *Client) PostOrgs(ctx context.Context, params *PostOrgsAllParams) (*Organization, error) ``` -------------------------------- ### OnboardingResponse Struct Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Defines the response payload after an onboarding operation. Includes details about the created authorization, bucket, organization, and user. ```go type OnboardingResponse struct { Auth *Authorization `json:"auth,omitempty"` Bucket *Bucket `json:"bucket,omitempty"` Org *Organization `json:"org,omitempty"` User *UserResponse `json:"user,omitempty"` } ``` -------------------------------- ### Get Instance Ping Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves the status and version of the InfluxDB instance. This function calls the GET /ping endpoint. Added in v2.5.0. ```go func (c *Client) GetPing(ctx context.Context) error ``` -------------------------------- ### Get Write Options Batch Size Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/write Retrieves the configured batch size for write operations. ```go func (o *Options) BatchSize() uint ``` -------------------------------- ### Create a new write Service Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/internal/write Creates a new write service with the specified organization, bucket, HTTP service, and options. ```go func NewService(org string, bucket string, httpService http2.Service, options *write.Options) *Service ``` -------------------------------- ### Get Organization Owners Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a list of all owners of a specific organization. This function calls the GET /orgs/{orgID}/owners endpoint. ```go func (c *Client) GetOrgsIDOwners(ctx context.Context, params *GetOrgsIDOwnersAllParams) (*ResourceOwners, error) ``` -------------------------------- ### Get Organization Members Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a list of all members of a specific organization. This function calls the GET /orgs/{orgID}/members endpoint. ```go func (c *Client) GetOrgsIDMembers(ctx context.Context, params *GetOrgsIDMembersAllParams) (*ResourceMembers, error) ``` -------------------------------- ### Define PostSetupJSONBody Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Defines parameters for the PostSetup function. It is an alias for OnboardingRequest. ```go type PostSetupJSONBody OnboardingRequest ``` -------------------------------- ### NewLabelsAPI Constructor Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api Creates a new instance of the LabelsAPI. Requires a domain.Client as input. ```go func NewLabelsAPI(apiClient *domain.Client) LabelsAPI ``` -------------------------------- ### Get Notification Rule by ID Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a specific notification rule by its ID. This function calls the GET /notificationRules/{ruleID} endpoint. ```go func (c *Client) GetNotificationRulesID(ctx context.Context, params *GetNotificationRulesIDAllParams) (*NotificationRule, error) ``` -------------------------------- ### Get Notification Endpoint by ID Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a specific notification endpoint by its ID. This function calls the GET /notificationEndpoints/{endpointID} endpoint. ```go func (c *Client) GetNotificationEndpointsID(ctx context.Context, params *GetNotificationEndpointsIDAllParams) (*NotificationEndpoint, error) ``` -------------------------------- ### Client.Setup Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Sends a request to initialize a new InfluxDB server with user, organization, bucket, and data retention period. It returns details about the newly created entities along with an authorization object. A retention period of zero results in infinite retention. ```APIDOC ## Client.Setup ### Description Sends a request to initialize a new InfluxDB server with user, organization, bucket, and data retention period. It returns details about the newly created entities along with an authorization object. A retention period of zero results in infinite retention. ### Method func (c Client) Setup(ctx context.Context, username, password, org, bucket string, retentionPeriodHours int) (*domain.OnboardingResponse, error) ``` -------------------------------- ### Get Dashboards Owners Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a list of owners for a specific dashboard. This function calls the GET /dashboards/{dashboardID}/owners endpoint. ```go func (c *Client) GetDashboardsIDOwners(ctx context.Context, params *GetDashboardsIDOwnersAllParams) (*ResourceOwners, error) ``` -------------------------------- ### Create New FakeClient Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/internal/examples Provides a constructor for creating a new instance of FakeClient. It accepts string arguments for token and URL, which are not used by the fake client. ```go func NewClient(_ string, _ string) *FakeClient ``` -------------------------------- ### Get Runtime Configuration Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves the runtime configuration of the InfluxDB instance. Added in v2.8.0. This function interacts with the GET /config endpoint. ```go func (c *Client) GetConfig(ctx context.Context, params *GetConfigParams) (*Config, error) ``` -------------------------------- ### Define PostSetupParams Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Defines parameters for the PostSetup function, including an optional OpenTracing span context. ```go type PostSetupParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } ``` -------------------------------- ### Get Application Name from Options Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/http ApplicationName returns the application name used in the User-Agent HTTP header. ```go func (o *Options) ApplicationName() string ``` -------------------------------- ### Get Organization Secrets Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves a list of all secret keys for a specific organization. This function calls the GET /orgs/{orgID}/secrets endpoint. ```go func (c *Client) GetOrgsIDSecrets(ctx context.Context, params *GetOrgsIDSecretsAllParams) (*SecretKeysResponse, error) ``` -------------------------------- ### Define Options Structure Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/internal/examples Defines the structure for Options, which is used to emulate client options. ```go type Options struct { } ``` -------------------------------- ### Perform GET Request (No-Op) Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/internal/test A no-operation method for handling GET requests. It does not perform any network operations and is intended for use in test scenarios. ```go func (t *HTTPService) GetRequest(_ context.Context, _ string, _ http2.RequestCallback, _ http2.ResponseCallback) *http2.Error ``` -------------------------------- ### NewClient Function Signature Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Creates a client for connecting to a given server URL with a provided authentication token using default options. The server URL should be the InfluxDB server base URL (e.g., http://localhost:8086). The authentication token can be empty for a new InfluxDB server, in which case Setup() will set the token. ```go func NewClient(serverURL string, authToken string) Client ``` -------------------------------- ### Get Notification Rule Query Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves the query associated with a specific notification rule. This function calls the GET /notificationRules/{ruleID}/query endpoint. ```go func (c *Client) GetNotificationRulesIDQuery(ctx context.Context, params *GetNotificationRulesIDQueryAllParams) (*FluxResponse, error) ``` -------------------------------- ### Get Notification Rule Labels Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves all labels associated with a specific notification rule. This function calls the GET /notificationRules/{ruleID}/labels endpoint. ```go func (c *Client) GetNotificationRulesIDLabels(ctx context.Context, params *GetNotificationRulesIDLabelsAllParams) (*LabelsResponse, error) ``` -------------------------------- ### Define PostSetupAllParams Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Defines all parameters for the PostSetup function, including nested parameters and the request body. Added in v2.11.0. ```go type PostSetupAllParams struct { PostSetupParams Body PostSetupJSONRequestBody } ``` -------------------------------- ### Get Notification Endpoint Labels Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Retrieves all labels associated with a specific notification endpoint. This function calls the GET /notificationEndpoints/{endpointID}/labels endpoint. ```go func (c *Client) GetNotificationEndpointsIDLabels(ctx context.Context, params *GetNotificationEndpointsIDLabelsAllParams) (*LabelsResponse, error) ``` -------------------------------- ### Create New HTTP Service Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/http Instantiate a new Service for HTTP operations. Remember to use the correct authorization token format. ```go srv := http.NewService("http://localhost:8086", "Token my-token", http.DefaultOptions()) ``` -------------------------------- ### Flux Script Using Secrets Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/domain Example Flux script demonstrating how to retrieve and use secrets for database connection credentials. ```flux import "sql" import "influxdata/influxdb/secrets" username = secrets.get(key: "POSTGRES_USERNAME") password = secrets.get(key: "POSTGRES_PASSWORD") sql.from( driverName: "postgres", dataSourceName: "postgresql://${username}:${password}@localhost:5432", query: "SELECT * FROM example_table", ) ``` -------------------------------- ### Get Variables Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/domain Retrieves a list of all variables. ```APIDOC ## GetVariables ### Description Retrieves a list of all variables. ### Method GET ### Endpoint /api/v2/variables ### Parameters #### Query Parameters - **offset** (int) - Optional - Offset for pagination. - **limit** (int) - Optional - Limit for pagination. ### Response #### Success Response (200) - **links** (*ResourceLinks) - Links to related resources. - **variables** ([]*Variable) - A list of variables. #### Response Example { "links": { "self": "/api/v2/variables" }, "variables": [ { "links": { "self": "/api/v2/variables/1" }, "id": "1", "name": "var1", "orgID": "1", "token": "token1" } ] } ``` -------------------------------- ### GetSetupParams Struct Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Defines parameters for the GetSetup API call. Includes tracing span information. ```go type GetSetupParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } ``` -------------------------------- ### Create New Test HTTP Service Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/internal/test Initializes and returns a new instance of HTTPService for testing. It requires a testing.T instance and the base server URL. ```go func NewTestService(t *testing.T, serverURL string) *HTTPService ``` -------------------------------- ### Get Point Timestamp Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/write Retrieves the timestamp associated with a Point. ```go func (m *Point) Time() time.Time ``` -------------------------------- ### FakeClient Options Method Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/internal/examples Implements the Options method for FakeClient, returning a pointer to Options. ```go func (c *FakeClient) Options() *Options ``` -------------------------------- ### Package Struct Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Represents a complete package source tree in the AST. Includes package name, import path, and associated files. ```go type Package struct { // Package files Files *[]File `json:"files,omitempty"` // Package name Package *string `json:"package,omitempty"` // Package import path Path *string `json:"path,omitempty"` // Type of AST node Type *NodeType `json:"type,omitempty"` } ``` -------------------------------- ### LabelCreateRequest_Properties Get Method Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Getter for additional properties within LabelCreateRequest_Properties. ```go func (a LabelCreateRequest_Properties) Get(fieldName string) (value string, found bool) ``` -------------------------------- ### NewDeleteAPI Constructor Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api Creates a new instance of the DeleteAPI. Requires a domain.Client as input. ```go func NewDeleteAPI(apiClient *domain.Client) DeleteAPI ``` -------------------------------- ### InfluxDB Client Initialization Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Creates a new InfluxDB client instance. Requires the server URL and an HTTP request doer. ```go func NewClient(server string, doer HTTPRequestDoer) (*Client, error) ``` -------------------------------- ### NewUsersAPI Function Signature Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api Creates a new instance of the UsersAPI. It requires a domain.Client, http.Service, and *nethttp.Client as input. ```go func NewUsersAPI(apiClient *domain.Client, httpService http.Service, httpClient *nethttp.Client) UsersAPI ``` -------------------------------- ### Get Point Measurement Name Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/write Retrieves the measurement name of a Point. ```go func (m *Point) Name() string ``` -------------------------------- ### Get FluxTableMetadata String Representation Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/query Returns a string dump of the FluxTableMetadata. ```go func (f *FluxTableMetadata) String() string ``` -------------------------------- ### Create Buckets API Instance Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api Instantiates a new BucketsAPI client. This function is used to create an object that provides access to bucket management operations. ```go func NewBucketsAPI(apiClient *domain.Client) BucketsAPI ``` -------------------------------- ### Get FluxRecord String Representation Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/query Returns a string dump of the FluxRecord. ```go func (r *FluxRecord) String() string ``` -------------------------------- ### Default Write Options Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/write Returns an Options object initialized with default write configuration values. ```go func DefaultOptions() *Options ``` -------------------------------- ### GetResources Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/domain List all known resources. This method calls the GET /resources endpoint. ```APIDOC ## GET /resources ### Description List all known resources. ### Method GET ### Endpoint /resources ### Parameters #### Query Parameters - **params** (*GetResourcesParams) - Required - Parameters for listing resources. ``` -------------------------------- ### Get HTTP Client from Options Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/http HTTPClient returns the http.Client configured for HTTP requests. It returns a client set via SetHTTPClient or a default client. Panics if SetHTTPDoer was called. ```go func (o *Options) HTTPClient() *http.Client ``` -------------------------------- ### HTTPNotificationEndpointMethod Constants Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Defines constant values for HTTPNotificationEndpointMethod: GET, POST, and PUT. ```go const ( HTTPNotificationEndpointMethodGET HTTPNotificationEndpointMethod = "GET" HTTPNotificationEndpointMethodPOST HTTPNotificationEndpointMethod = "POST" HTTPNotificationEndpointMethodPUT HTTPNotificationEndpointMethod = "PUT" ) ``` -------------------------------- ### Get Variables ID Labels Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/domain Retrieves labels for a specific variable by its ID. ```APIDOC ## GetVariablesIDLabels ### Description Retrieves labels for a specific variable by its ID. ### Method GET ### Endpoint /api/v2/variables/{variableID}/labels ### Parameters #### Path Parameters - **variableID** (string) - Required - The ID of the variable. #### Query Parameters - **offset** (int) - Optional - Offset for pagination. - **limit** (int) - Optional - Limit for pagination. ### Response #### Success Response (200) - **links** (*ResourceLinks) - Links to related resources. - **labels** ([]*LabelResponse) - A list of labels associated with the variable. #### Response Example { "links": { "self": "/api/v2/variables/1/labels" }, "labels": [ { "links": { "self": "/api/v2/labels/1" }, "id": "1", "name": "label1", "orgID": "1" } ] } ``` -------------------------------- ### Get HTTP Client Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/internal/test Returns nil for the HTTP client. This is a deliberate behavior for the test service, indicating that it does not use a standard http.Client. ```go func (t *HTTPService) HTTPClient() *http.Client ``` -------------------------------- ### List Dashboards Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Lists all dashboards. This function interacts with the GET /dashboards endpoint. ```go func (c *Client) GetDashboards(ctx context.Context, params *GetDashboardsParams) (*Dashboards, error) ``` -------------------------------- ### Client.Options Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Returns the options associated with the client. ```APIDOC ## Client.Options ### Description Returns the options associated with the client. ### Method func (c Client) Options() *Options ``` -------------------------------- ### List Checks Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Lists all checks. This function interacts with the GET /checks endpoint. ```go func (c *Client) GetChecks(ctx context.Context, params *GetChecksParams) (*Checks, error) ``` -------------------------------- ### Permission Struct Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Defines the Permission model, including action and resource. ```go type Permission struct { Action PermissionAction `json:"action"` Resource Resource `json:"resource"` } ``` -------------------------------- ### Generate client Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Generate the Go API client from the OpenAPI specification, excluding 'Checks' tags. ```bash oapi-codegen -generate client -exclude-tags Checks -o client.gen.go -package domain -templates .\templates oss.yml ``` -------------------------------- ### List Authorizations Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Lists all authorizations. This function interacts with the GET /authorizations endpoint. ```go func (c *Client) GetAuthorizations(ctx context.Context, params *GetAuthorizationsParams) (*Authorizations, error) ``` -------------------------------- ### Create User Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Creates a new user. This function calls the POST /users endpoint. ```go func (c *Client) PostUsers(ctx context.Context, params *PostUsersAllParams) (*UserResponse, error) ``` -------------------------------- ### Get HTTP Request Timeout Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Retrieves the HTTP request timeout duration. ```go func (o *Options) HTTPRequestTimeout() uint ``` -------------------------------- ### Flux Script Using Secrets Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Example Flux script demonstrating how to retrieve and use secrets for database connections. Requires importing 'sql' and 'influxdata/influxdb/secrets' packages. ```flux import "sql" import "influxdata/influxdb/secrets" username = secrets.get(key: "POSTGRES_USERNAME") password = secrets.get(key: "POSTGRES_PASSWORD") sql.from( driverName: "postgres", dataSourceName: "postgresql://${username}:${password}@localhost:5432", query: "SELECT * FROM example_table", ) ``` -------------------------------- ### Get Decoded Lines Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/internal/test Returns the decoded lines from a request that have been processed by the service. ```go func (t *HTTPService) Lines() []string ``` -------------------------------- ### Create InfluxDB Client with Default Options Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0 Creates a new InfluxDB client instance using the default configuration options. This is suitable for basic usage. ```go client := influxdb2.NewClient("http://localhost:8086", "my-token") ``` -------------------------------- ### Options Methods Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api/http Methods for configuring and retrieving HTTP options. ```APIDOC ## Options Methods ### Description This section details the methods available on the `Options` type for configuring HTTP client behavior. #### ApplicationName - **Method**: `ApplicationName()` - **Description**: Returns the application name used in the User-Agent HTTP header. #### HTTPClient - **Method**: `HTTPClient()` - **Description**: Returns the configured `http.Client`. If not set, it constructs a default client. Panics if `SetHTTPDoer` was called. #### HTTPDoer - **Method**: `HTTPDoer()` - **Description**: Returns the configured `Doer` if set, otherwise returns the `http.Client`. #### HTTPRequestTimeout - **Method**: `HTTPRequestTimeout()` - **Description**: Returns the configured HTTP request timeout. #### OwnHTTPClient - **Method**: `OwnHTTPClient()` - **Description**: Returns `true` if the HTTP client was created internally, `false` if set externally. #### SetApplicationName - **Method**: `SetApplicationName(appName string)` - **Description**: Sets an application name to be used in the User-Agent HTTP header. - **Parameters**: - **appName** (string) - Required - The name of the application. - **Returns**: `*Options` - The modified Options object. #### SetHTTPClient - **Method**: `SetHTTPClient(c *http.Client)` - **Description**: Sets a custom `http.Client` to be used for HTTP requests. - **Parameters**: - **c** (*http.Client) - Required - The custom HTTP client. #### SetHTTPDoer - **Method**: `SetHTTPDoer(d Doer)` - **Description**: Sets a custom `Doer` for performing HTTP operations. - **Parameters**: - **d** (Doer) - Required - The custom Doer. #### SetHTTPRequestTimeout - **Method**: `SetHTTPRequestTimeout(httpRequestTimeout uint)` - **Description**: Sets the timeout for HTTP requests. - **Parameters**: - **httpRequestTimeout** (uint) - Required - The timeout duration in seconds. #### SetTLSConfig - **Method**: `SetTLSConfig(tlsConfig *tls.Config)` - **Description**: Sets the TLS configuration for HTTPS connections. - **Parameters**: - **tlsConfig** (*tls.Config) - Required - The TLS configuration. #### TLSConfig - **Method**: `TLSConfig()` - **Description**: Returns the configured TLS configuration. ``` -------------------------------- ### Get Point Tag List Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/write Retrieves a list of all tags associated with a Point. ```go func (m *Point) TagList() []*lp.Tag ``` -------------------------------- ### Get Point Field List Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/write Retrieves a list of all fields associated with a Point. ```go func (m *Point) FieldList() []*lp.Field ``` -------------------------------- ### Set TLS Configuration Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api/http Sets the TLS configuration for a secure connection. ```go func (o *Options) SetTLSConfig(tlsConfig *tls.Config) *Options ``` -------------------------------- ### Format User-Agent String Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/internal/http Creates a User-Agent header value for a given application name. This function is available from v2.12.0. ```go func FormatUserAgent(appName string) string { return fmt.Sprintf("%s %s", UserAgentBase, appName) } ``` -------------------------------- ### RunManuallyWithID Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api Manually start a run of a task with taskID now, overriding the current schedule. ```APIDOC ## RunManuallyWithID ### Description Manually start a run of a task with taskID now, overriding the current schedule. ### Method [Method not specified, likely POST] ### Endpoint [Endpoint not specified] ### Parameters #### Path Parameters - **taskID** (string) - Required - The ID of the task. #### Query Parameters None ### Request Example ``` POST /tasks/{taskID}/runs ``` ### Response #### Success Response (200) - **domain.Run** - The newly created run object. #### Response Example ```json { "id": "new-run-id", "taskID": "taskID", "status": "running" } ``` ``` -------------------------------- ### CreateBucket Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/api Creates a new bucket. Requires a bucket object containing the desired properties. ```APIDOC ## CreateBucket ### Description Creates a new bucket. ### Method POST ### Endpoint /api/v2/buckets ### Request Body - **bucket** (domain.Bucket) - Required - The bucket object to create. - **name** (string) - Required - The name of the bucket. - **orgID** (string) - Required - The ID of the organization the bucket belongs to. - **retentionRules** ([]domain.RetentionRule) - Optional - Rules for data retention. ### Request Example { "name": "my-bucket", "orgID": "yourOrgID", "retentionRules": [ { "everySeconds": 3600 } ] } ### Response #### Success Response (201) - **bucket** (domain.Bucket) - The created bucket object. #### Response Example { "id": "string", "name": "my-bucket", "orgID": "yourOrgID", "createdAt": "string", "updatedAt": "string", "retentionRules": [ { "everySeconds": 3600 } ] } ``` -------------------------------- ### GetQuerySuggestions Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/domain Retrieve Flux query suggestions. This method calls the GET /query/suggestions endpoint. ```APIDOC ## GET /query/suggestions ### Description Retrieve Flux query suggestions. ### Method GET ### Endpoint /query/suggestions ### Parameters #### Query Parameters - **params** (*GetQuerySuggestionsParams) - Required - Parameters for retrieving query suggestions. ``` -------------------------------- ### PostBucketRequest Struct Source: https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2%40v2.14.0/domain Defines the request body for creating a bucket, including name, organization ID, description, and retention rules. ```go type PostBucketRequest struct { // A description of the bucket. Description *string `json:"description,omitempty"` // The name of the bucket. Name string `json:"name"` // Organization ID. // The ID of the organization. OrgID string `json:"orgID"` // Retention rules to expire or retain data. // #### InfluxDB Cloud // // - `retentionRules` is required. // // #### InfluxDB OSS // // - `retentionRules` isn't required. RetentionRules *RetentionRules `json:"retentionRules,omitempty"` // Retention policy is an InfluxDB 1.x concept that represents the duration // of time that each data point in the retention policy persists. Use `rp` // for compatibility with InfluxDB 1.x. // The InfluxDB 2.x and Cloud equivalent is // [retention period](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#retention-period). Rp *string `json:"rp,omitempty"` SchemaType *SchemaType `json:"schemaType,omitempty"` } ```