Documentation
¶
Index ¶
- func DeeplinkURL(apiUrl, assetType, assetID string) string
- func KindDisplayName(kind string) string
- func LogsExplorerURL(apiUrl string, filters []DeeplinkFilter, from, to string, dataset *string) string
- func PrintDiff(w io.Writer, displayKind, name string, before, after any) error
- func ReadDefinition(path string, target interface{}, stdin io.Reader) error
- func ReadDefinitionFile(path string, target interface{}) error
- func ReadRawInput(path string, stdin io.Reader) ([]byte, error)
- func RegisterCommonFlags(cmd *cobra.Command, flags *CommonFlags)
- func RegisterDeleteFlags(cmd *cobra.Command, flags *DeleteFlags)
- func RegisterFileInputFlags(cmd *cobra.Command, flags *FileInputFlags)
- func RegisterGetFlags(cmd *cobra.Command, flags *GetFlags)
- func RegisterListFlags(cmd *cobra.Command, flags *ListFlags)
- func SpansExplorerURL(apiUrl string, filters []DeeplinkFilter, from, to string, dataset *string) string
- func TracesExplorerURL(apiUrl, traceID string, dataset *string) string
- func ViewDeeplinkURL(apiUrl, viewType, assetID string) string
- func WriteDefinitionFile(path string, data interface{}) error
- func WriteToStdout(format string, data interface{}) error
- type CommonFlags
- type DeeplinkFilter
- type DeleteFlags
- type FileInputFlags
- type GetFlags
- type ImportAction
- type ImportResult
- func ImportCheckRule(ctx context.Context, apiClient dash0api.Client, ...) (ImportResult, error)
- func ImportDashboard(ctx context.Context, apiClient dash0api.Client, ...) (ImportResult, error)
- func ImportNotificationChannel(ctx context.Context, apiClient dash0api.Client, ...) (ImportResult, error)
- func ImportSyntheticCheck(ctx context.Context, apiClient dash0api.Client, ...) (ImportResult, error)
- func ImportView(ctx context.Context, apiClient dash0api.Client, view *dash0api.ViewDefinition, ...) (ImportResult, error)
- type ListFlags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeeplinkURL ¶ added in v1.2.0
DeeplinkURL constructs a deeplink URL for the given asset type and ID. The base URL is derived from the API URL by extracting the domain suffix (e.g. "dash0.com" from "api.us-west-2.aws.dash0.com") and prepending "app.". Returns an empty string if the API URL is empty or cannot be parsed.
func KindDisplayName ¶ added in v1.1.0
KindDisplayName returns the human-readable name for an asset kind. Multi-word kinds like "CheckRule" become "Check rule" and "SyntheticCheck" becomes "Synthetic check".
func LogsExplorerURL ¶ added in v1.5.4
func LogsExplorerURL(apiUrl string, filters []DeeplinkFilter, from, to string, dataset *string) string
LogsExplorerURL builds a deep link URL to the Dash0 logs explorer. The URL includes filter criteria, time range, and optional dataset as query parameters. Returns an empty string if the API URL is empty or cannot be parsed.
func PrintDiff ¶ added in v1.7.0
PrintDiff computes a unified diff between the before and after states of an asset and writes it to w. If there are no changes, a "no changes" message is printed instead.
func ReadDefinition ¶
ReadDefinition reads a YAML or JSON definition from a file or stdin. If path is "-" or empty, it reads from stdin (assumes YAML format). Otherwise, it reads from the file at the given path.
func ReadDefinitionFile ¶
ReadDefinitionFile reads a YAML or JSON file and unmarshals into the target. It auto-detects the format based on file extension, falling back to YAML first.
func ReadRawInput ¶ added in v1.1.0
ReadRawInput reads raw bytes from a file or stdin without unmarshalling. If path is "-" or empty, it reads from stdin.
func RegisterCommonFlags ¶
func RegisterCommonFlags(cmd *cobra.Command, flags *CommonFlags)
RegisterCommonFlags adds common flags to a command
func RegisterDeleteFlags ¶
func RegisterDeleteFlags(cmd *cobra.Command, flags *DeleteFlags)
RegisterDeleteFlags adds delete-specific flags to a command
func RegisterFileInputFlags ¶
func RegisterFileInputFlags(cmd *cobra.Command, flags *FileInputFlags)
RegisterFileInputFlags adds file input flags to a command and marks -f as required
func RegisterGetFlags ¶
RegisterGetFlags adds get-specific flags to a command
func RegisterListFlags ¶
RegisterListFlags adds list-specific flags to a command
func SpansExplorerURL ¶ added in v1.5.4
func SpansExplorerURL(apiUrl string, filters []DeeplinkFilter, from, to string, dataset *string) string
SpansExplorerURL builds a deep link URL to the Dash0 traces explorer. The URL includes optional filter criteria, time range, and optional dataset as query parameters. Returns an empty string if the API URL is empty or cannot be parsed.
func TracesExplorerURL ¶ added in v1.5.4
TracesExplorerURL builds a deep link URL to the Dash0 traces explorer for a specific trace. The URL includes the trace ID and optional dataset as query parameters. Returns an empty string if the API URL is empty or cannot be parsed.
func ViewDeeplinkURL ¶ added in v1.5.1
ViewDeeplinkURL constructs a deeplink URL for a view, using the view's type to determine the correct path (e.g. /goto/spans for span views, /goto/logs for log views). Returns an empty string if the API URL is empty, cannot be parsed, or the view type is unknown.
func WriteDefinitionFile ¶
WriteDefinitionFile writes data to a YAML or JSON file. It auto-detects the format based on file extension, defaulting to YAML.
func WriteToStdout ¶
WriteToStdout writes data to stdout in the specified format. Format can be "yaml", "yml", or "json".
Types ¶
type CommonFlags ¶
CommonFlags holds common flag values used across all asset commands
type DeeplinkFilter ¶ added in v1.5.4
type DeeplinkFilter struct {
Key string `json:"key"`
Operator string `json:"operator"`
Value string `json:"value,omitempty"`
}
DeeplinkFilter represents a single filter criterion for explorer deep links.
func FiltersToDeeplinkFilters ¶ added in v1.5.4
func FiltersToDeeplinkFilters(filters *dash0api.FilterCriteria) []DeeplinkFilter
FiltersToDeeplinkFilters converts parsed API filter criteria to deep link filter objects suitable for URL serialization.
type DeleteFlags ¶
type DeleteFlags struct {
CommonFlags
Force bool
}
DeleteFlags holds flags specific to delete commands
type FileInputFlags ¶
type FileInputFlags struct {
CommonFlags
File string
DryRun bool
}
FileInputFlags holds flags for file-based input operations (create, update, apply)
type ImportAction ¶ added in v1.1.0
type ImportAction string
ImportAction indicates whether an asset was created or updated.
const ( ActionCreated ImportAction = "created" ActionUpdated ImportAction = "updated" )
type ImportResult ¶ added in v1.1.0
type ImportResult struct {
Name string
ID string
Action ImportAction
Before any // asset state before update (nil for creates)
After any // asset state after update/create
}
ImportResult holds the outcome of importing an asset.
func ImportCheckRule ¶ added in v1.1.0
func ImportCheckRule(ctx context.Context, apiClient dash0api.Client, rule *dash0api.PrometheusAlertRule, dataset *string) (ImportResult, error)
ImportCheckRule creates or updates a check rule via the standard CRUD APIs. When the input has a user-defined ID, UPDATE is always used — PUT has create-or-replace semantics, so this is idempotent regardless of whether the rule already exists. When the input has no ID, CREATE is used and the server assigns an ID.
func ImportDashboard ¶ added in v1.1.0
func ImportDashboard(ctx context.Context, apiClient dash0api.Client, dashboard *dash0api.DashboardDefinition, dataset *string) (ImportResult, error)
ImportDashboard creates or updates a dashboard via the standard CRUD APIs. When the input has a user-defined ID, UPDATE is always used — PUT has create-or-replace semantics, so this is idempotent regardless of whether the dashboard already exists. When the input has no ID, CREATE is used and the server assigns an ID.
func ImportNotificationChannel ¶ added in v1.9.0
func ImportNotificationChannel(ctx context.Context, apiClient dash0api.Client, channel *dash0api.NotificationChannelDefinition) (ImportResult, error)
ImportNotificationChannel creates or updates a notification channel via the standard CRUD APIs. When the input has a user-defined ID (via dash0.com/origin label), UPDATE is always used — PUT has create-or-replace semantics, so this is idempotent regardless of whether the channel already exists. When the input has no origin, CREATE is used and the server assigns an ID.
func ImportSyntheticCheck ¶ added in v1.1.0
func ImportSyntheticCheck(ctx context.Context, apiClient dash0api.Client, check *dash0api.SyntheticCheckDefinition, dataset *string) (ImportResult, error)
ImportSyntheticCheck creates or updates a synthetic check via the standard CRUD APIs. When the input has a user-defined ID, UPDATE is always used — PUT has create-or-replace semantics, so this is idempotent regardless of whether the check already exists. When the input has no ID, CREATE is used and the server assigns an ID.
func ImportView ¶ added in v1.1.0
func ImportView(ctx context.Context, apiClient dash0api.Client, view *dash0api.ViewDefinition, dataset *string) (ImportResult, error)
ImportView creates or updates a view via the standard CRUD APIs. When the input has a user-defined ID, UPDATE is always used — PUT has create-or-replace semantics, so this is idempotent regardless of whether the view already exists. When the input has no ID, CREATE is used and the server assigns an ID.