client

package
v0.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

Types

type APIResponse

type APIResponse[T any] struct {
	Status    int    `json:"status"`
	RequestID string `json:"requestId"`
	Result    T      `json:"result"`
	Error     string `json:"error,omitempty"`
}

APIResponse is the ClickHouse Cloud API envelope.

type Alert

type Alert struct {
	ID                    string         `json:"id,omitempty"`
	Name                  *string        `json:"name,omitempty"`
	Message               *string        `json:"message,omitempty"`
	Source                string         `json:"source"`
	Threshold             float64        `json:"threshold"`
	ThresholdType         string         `json:"thresholdType"`
	Interval              string         `json:"interval"`
	NumConsecutiveWindows *int64         `json:"numConsecutiveWindows,omitempty"`
	Channel               AlertChannel   `json:"channel"`
	DashboardID           *string        `json:"dashboardId,omitempty"`
	TileID                *string        `json:"tileId,omitempty"`
	SavedSearchID         *string        `json:"savedSearchId,omitempty"`
	GroupBy               *string        `json:"groupBy,omitempty"`
	ScheduleOffsetMinutes *int           `json:"scheduleOffsetMinutes,omitempty"`
	ScheduleStartAt       *string        `json:"scheduleStartAt,omitempty"`
	State                 string         `json:"state,omitempty"`
	TeamID                string         `json:"teamId,omitempty"`
	Silenced              *AlertSilenced `json:"silenced,omitempty"`
	CreatedAt             *string        `json:"createdAt,omitempty"`
	UpdatedAt             *string        `json:"updatedAt,omitempty"`
}

Alert represents a ClickStack alert.

type AlertChannel

type AlertChannel struct {
	Type string `json:"type"`
	// Webhook fields
	WebhookID      *string `json:"webhookId,omitempty"`
	WebhookService *string `json:"webhookService,omitempty"`
	SlackChannelID *string `json:"slackChannelId,omitempty"`
	Severity       *string `json:"severity,omitempty"`
	// Email fields
	EmailRecipients []string `json:"emailRecipients,omitempty"`
}

AlertChannel represents the notification channel for an alert.

type AlertSilenced

type AlertSilenced struct {
	By    string  `json:"by"`
	At    string  `json:"at"`
	Until *string `json:"until,omitempty"`
}

AlertSilenced represents silencing metadata on an alert.

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL, organizationID, serviceID, apiKeyID, apiKeySecret string) *Client

func (*Client) CreateAlert

func (c *Client) CreateAlert(ctx context.Context, alert Alert) (*Alert, error)

func (*Client) CreateDashboard

func (c *Client) CreateDashboard(ctx context.Context, dashboard Dashboard) (*Dashboard, error)

func (*Client) CreateSavedSearch

func (c *Client) CreateSavedSearch(ctx context.Context, search SavedSearch) (*SavedSearch, error)

func (*Client) DeleteAlert

func (c *Client) DeleteAlert(ctx context.Context, id string) error

func (*Client) DeleteDashboard

func (c *Client) DeleteDashboard(ctx context.Context, id string) error

func (*Client) DeleteSavedSearch

func (c *Client) DeleteSavedSearch(ctx context.Context, id string) error

func (*Client) GetAlert

func (c *Client) GetAlert(ctx context.Context, id string) (*Alert, error)

func (*Client) GetDashboard

func (c *Client) GetDashboard(ctx context.Context, id string) (*Dashboard, error)

func (*Client) GetSavedSearch

func (c *Client) GetSavedSearch(ctx context.Context, id string) (*SavedSearch, error)

func (*Client) ListAlerts

func (c *Client) ListAlerts(ctx context.Context) ([]Alert, error)

func (*Client) ListDashboards

func (c *Client) ListDashboards(ctx context.Context) ([]Dashboard, error)

func (*Client) ListSavedSearches

func (c *Client) ListSavedSearches(ctx context.Context) ([]SavedSearch, error)

func (*Client) ListSources

func (c *Client) ListSources(ctx context.Context) ([]Source, error)

func (*Client) ListWebhooks

func (c *Client) ListWebhooks(ctx context.Context) ([]Webhook, error)

func (*Client) UpdateAlert

func (c *Client) UpdateAlert(ctx context.Context, id string, alert Alert) (*Alert, error)

func (*Client) UpdateDashboard

func (c *Client) UpdateDashboard(ctx context.Context, id string, dashboard Dashboard) (*Dashboard, error)

func (*Client) UpdateSavedSearch

func (c *Client) UpdateSavedSearch(ctx context.Context, id string, search SavedSearch) (*SavedSearch, error)

type Dashboard

type Dashboard struct {
	ID                 string             `json:"id,omitempty"`
	Name               string             `json:"name"`
	Tiles              []Tile             `json:"tiles"`
	Tags               []string           `json:"tags,omitempty"`
	Filters            []Filter           `json:"filters,omitempty"`
	SavedQuery         *string            `json:"savedQuery,omitempty"`
	SavedQueryLanguage *string            `json:"savedQueryLanguage,omitempty"`
	SavedFilterValues  []SavedFilterValue `json:"savedFilterValues,omitempty"`
}

Dashboard represents a ClickStack dashboard.

type Filter

type Filter struct {
	ID               string  `json:"id,omitempty"`
	Type             string  `json:"type"`
	Name             string  `json:"name"`
	Expression       string  `json:"expression"`
	SourceID         string  `json:"sourceId"`
	SourceMetricType *string `json:"sourceMetricType,omitempty"`
}

Filter represents a dashboard-level filter.

type NotFoundError

type NotFoundError struct {
	Message   string
	RequestID string
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type SavedFilterValue

type SavedFilterValue struct {
	Condition string  `json:"condition"`
	Type      *string `json:"type,omitempty"`
}

SavedFilterValue represents a persisted filter value on a dashboard.

type SavedSearch

type SavedSearch struct {
	ID            string              `json:"id,omitempty"`
	Name          string              `json:"name"`
	SourceID      string              `json:"sourceId"`
	Select        string              `json:"select,omitempty"`
	Where         string              `json:"where,omitempty"`
	WhereLanguage string              `json:"whereLanguage,omitempty"`
	OrderBy       string              `json:"orderBy,omitempty"`
	Tags          []string            `json:"tags,omitempty"`
	Filters       []SavedSearchFilter `json:"filters,omitempty"`
	TeamID        string              `json:"teamId,omitempty"`
	CreatedAt     string              `json:"createdAt,omitempty"`
	UpdatedAt     string              `json:"updatedAt,omitempty"`
}

SavedSearch represents a ClickStack saved search.

type SavedSearchFilter added in v0.0.3

type SavedSearchFilter struct {
	Type      string `json:"type,omitempty"`
	Condition string `json:"condition"`
}

SavedSearchFilter represents a SQL predicate pinned to a saved search.

type Source

type Source struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Kind string `json:"kind"`
}

Source represents a ClickStack data source (read-only).

type Tile

type Tile struct {
	ID     string          `json:"id,omitempty"`
	Name   string          `json:"name"`
	X      int             `json:"x"`
	Y      int             `json:"y"`
	W      int             `json:"w"`
	H      int             `json:"h"`
	Config json.RawMessage `json:"config,omitempty"`
	Series json.RawMessage `json:"series,omitempty"`
}

Tile represents a dashboard tile.

type Webhook

type Webhook struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Service     string  `json:"service"`
	URL         string  `json:"url"`
	Description *string `json:"description,omitempty"`
	CreatedAt   *string `json:"createdAt,omitempty"`
	UpdatedAt   *string `json:"updatedAt,omitempty"`
}

Webhook represents a ClickStack webhook (read-only).

Jump to

Keyboard shortcuts

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