client

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatasetPtr

func DatasetPtr(dataset string) *string

DatasetPtr converts a dataset string to a pointer, returning nil for empty strings. This is a helper for API calls that accept optional dataset parameters.

func HandleAPIError

func HandleAPIError(err error, ctx ...ErrorContext) error

HandleAPIError provides user-friendly error messages for API errors. It checks for common error types and returns descriptive messages. Optional context can be provided to include asset details in error messages.

func NewClient

func NewClient(apiUrl, authToken string) (dash0.Client, error)

NewClient creates a new Dash0 API client from the given configuration overrides. It uses config.ResolveConfiguration to handle the configuration resolution hierarchy: environment variables > command-line flags > active profile Deprecated: Use NewClientFromContext for commands that run within the CLI context.

func NewClientFromContext

func NewClientFromContext(ctx context.Context, apiUrl, authToken string) (dash0.Client, error)

NewClientFromContext creates a new Dash0 API client using configuration from context. Flag overrides (apiUrl, authToken) are applied on top of the context configuration.

Types

type ErrorContext

type ErrorContext struct {
	AssetType string // e.g., "dashboard", "check rule"
	AssetID   string // e.g., "a1b2c3d4-..." (optional, empty for create/list)
	AssetName string // e.g., "Production Overview" (optional, for user-friendly messages)
}

ErrorContext provides context about the asset involved in an error. This context is used to generate more specific and actionable error messages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL