Documentation
¶
Index ¶
- func ExtractDateString(raw json.RawMessage) string
- type APIClient
- func (c *APIClient) CreateAgent(ctx context.Context, name, description, systemPrompt, visibility string) (*Agent, error)
- func (c *APIClient) CreateConnection(ctx context.Context, name, connType string, credentials map[string]any) error
- func (c *APIClient) CreateDashboard(ctx context.Context, title, visibility string, state map[string]any) (*Dashboard, error)
- func (c *APIClient) CreateScheduledAgent(ctx context.Context, fields map[string]any) (*ScheduledAgent, error)
- func (c *APIClient) DeleteConnection(ctx context.Context, name string) error
- func (c *APIClient) DeletePipeline(ctx context.Context, project, pipeline string) error
- func (c *APIClient) DisablePipeline(ctx context.Context, project, pipeline string) error
- func (c *APIClient) EnablePipeline(ctx context.Context, project, pipeline string) error
- func (c *APIClient) GetAgent(ctx context.Context, agentID int) (*Agent, error)
- func (c *APIClient) GetAgentMessageStatus(ctx context.Context, agentID, threadID, messageID int) (*AgentMessage, error)
- func (c *APIClient) GetAgentPrompt(ctx context.Context, agentID int) (*AgentPrompt, error)
- func (c *APIClient) GetAsset(ctx context.Context, project, pipeline, asset string) (*Asset, error)
- func (c *APIClient) GetDashboard(ctx context.Context, dashboardID int) (*Dashboard, error)
- func (c *APIClient) GetGlossaryEntity(ctx context.Context, project, entityName string) (json.RawMessage, error)
- func (c *APIClient) GetInstance(ctx context.Context, project, pipeline, runID, assetName string) (json.RawMessage, error)
- func (c *APIClient) GetInstanceLogs(ctx context.Context, project, pipeline, runID, stepID string, tryNumber int) (json.RawMessage, error)
- func (c *APIClient) GetLatestRun(ctx context.Context, project, pipeline string) (*PipelineRun, error)
- func (c *APIClient) GetPipeline(ctx context.Context, project, name string) (*Pipeline, error)
- func (c *APIClient) GetPipelineErrors(ctx context.Context) ([]json.RawMessage, error)
- func (c *APIClient) GetRun(ctx context.Context, project, pipeline, runID string) (*PipelineRun, error)
- func (c *APIClient) GetScheduledAgent(ctx context.Context, scheduledAgentID int) (*ScheduledAgent, error)
- func (c *APIClient) ListAgentMessages(ctx context.Context, agentID, threadID int, limit, offset int) ([]AgentMessage, error)
- func (c *APIClient) ListAgentThreads(ctx context.Context, agentID int, limit, offset int) ([]AgentThread, error)
- func (c *APIClient) ListAgents(ctx context.Context) ([]Agent, error)
- func (c *APIClient) ListAssets(ctx context.Context, project, pipeline string) ([]Asset, error)
- func (c *APIClient) ListConnections(ctx context.Context) ([]Connection, error)
- func (c *APIClient) ListDashboards(ctx context.Context) ([]Dashboard, error)
- func (c *APIClient) ListGlossaryEntities(ctx context.Context) (json.RawMessage, error)
- func (c *APIClient) ListInstances(ctx context.Context, project, pipeline, runID string) (json.RawMessage, error)
- func (c *APIClient) ListInstancesParsed(ctx context.Context, project, pipeline, runID string) (*AssetInstanceResponse, error)
- func (c *APIClient) ListPipelines(ctx context.Context) ([]Pipeline, error)
- func (c *APIClient) ListProjects(ctx context.Context) ([]Project, error)
- func (c *APIClient) ListRuns(ctx context.Context, project, pipeline string, limit, offset int) ([]PipelineRun, error)
- func (c *APIClient) ListScheduledAgents(ctx context.Context) ([]ScheduledAgent, error)
- func (c *APIClient) MarkRunStatus(ctx context.Context, project, pipeline, runID, status string) error
- func (c *APIClient) RerunRun(ctx context.Context, project, pipeline, runID string, onlyFailed bool) error
- func (c *APIClient) SendAgentMessage(ctx context.Context, agentID int, message string, threadID *int) (json.RawMessage, error)
- func (c *APIClient) SetAgentPrompt(ctx context.Context, agentID int, systemPrompt string) (*AgentPrompt, error)
- func (c *APIClient) TriggerRun(ctx context.Context, project, pipeline, startDate, endDate string, ...) error
- func (c *APIClient) UpdateAgent(ctx context.Context, agentID int, fields map[string]any) (*Agent, error)
- func (c *APIClient) UpdateDashboard(ctx context.Context, dashboardID int, fields map[string]any) (*Dashboard, error)
- func (c *APIClient) UpdateScheduledAgent(ctx context.Context, scheduledAgentID int, fields map[string]any) (*ScheduledAgent, error)
- type APIError
- type Agent
- type AgentMessage
- type AgentPrompt
- type AgentThread
- type Asset
- type AssetInstance
- type AssetInstanceCheck
- type AssetInstanceChecks
- type AssetInstanceInfo
- type AssetInstanceResponse
- type AssetInstanceSteps
- type BruinCloudConfig
- type Client
- type Config
- type Connection
- type Dashboard
- type GlossaryEntity
- type LogEntry
- type Pipeline
- type PipelineRun
- type PipelineValidationError
- type Project
- type Repo
- type ScheduledAgent
- type SendAgentMessageResponse
- type StepInstance
- type TriggerRunOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractDateString ¶ added in v0.11.494
func ExtractDateString(raw json.RawMessage) string
ExtractDateString extracts a date string from the API's date JSON format. API dates come as {"date": "2026-03-06 20:22:29.753319", "timezone_type": 1, "timezone": "+00:00"}.
Types ¶
type APIClient ¶ added in v0.11.494
type APIClient struct {
// contains filtered or unexported fields
}
APIClient is the HTTP client for the Bruin Cloud API.
func NewAPIClient ¶ added in v0.11.494
NewAPIClient creates a new API client with the given API key.
func (*APIClient) CreateAgent ¶ added in v0.11.665
func (c *APIClient) CreateAgent(ctx context.Context, name, description, systemPrompt, visibility string) (*Agent, error)
CreateAgent creates a new agent. Optional fields are omitted when empty so the server applies its defaults (null description/prompt, "team" visibility).
func (*APIClient) CreateConnection ¶ added in v0.11.635
func (*APIClient) CreateDashboard ¶ added in v0.11.668
func (c *APIClient) CreateDashboard(ctx context.Context, title, visibility string, state map[string]any) (*Dashboard, error)
CreateDashboard creates a dashboard from a definition. The server writes the definition to the draft only (never published). Empty optional fields are omitted so the server applies its defaults.
func (*APIClient) CreateScheduledAgent ¶ added in v0.11.682
func (c *APIClient) CreateScheduledAgent(ctx context.Context, fields map[string]any) (*ScheduledAgent, error)
CreateScheduledAgent creates a scheduled agent from a plan. The server stores it as an inactive draft (a human activates it from the UI); fields is the request body and must include agent_id.
func (*APIClient) DeleteConnection ¶ added in v0.11.635
func (*APIClient) DeletePipeline ¶ added in v0.11.494
func (*APIClient) DisablePipeline ¶ added in v0.11.494
func (*APIClient) EnablePipeline ¶ added in v0.11.494
func (*APIClient) GetAgentMessageStatus ¶ added in v0.11.494
func (*APIClient) GetAgentPrompt ¶ added in v0.11.661
func (*APIClient) GetDashboard ¶ added in v0.11.667
func (*APIClient) GetGlossaryEntity ¶ added in v0.11.494
func (*APIClient) GetInstance ¶ added in v0.11.494
func (*APIClient) GetInstanceLogs ¶ added in v0.11.494
func (*APIClient) GetLatestRun ¶ added in v0.11.494
func (*APIClient) GetPipeline ¶ added in v0.11.494
func (*APIClient) GetPipelineErrors ¶ added in v0.11.494
func (*APIClient) GetScheduledAgent ¶ added in v0.11.682
func (*APIClient) ListAgentMessages ¶ added in v0.11.494
func (*APIClient) ListAgentThreads ¶ added in v0.11.494
func (*APIClient) ListAgents ¶ added in v0.11.494
func (*APIClient) ListAssets ¶ added in v0.11.494
func (*APIClient) ListConnections ¶ added in v0.11.635
func (c *APIClient) ListConnections(ctx context.Context) ([]Connection, error)
func (*APIClient) ListDashboards ¶ added in v0.11.667
func (*APIClient) ListGlossaryEntities ¶ added in v0.11.494
func (*APIClient) ListInstances ¶ added in v0.11.494
func (*APIClient) ListInstancesParsed ¶ added in v0.11.494
func (*APIClient) ListPipelines ¶ added in v0.11.494
func (*APIClient) ListProjects ¶ added in v0.11.494
func (*APIClient) ListScheduledAgents ¶ added in v0.11.682
func (c *APIClient) ListScheduledAgents(ctx context.Context) ([]ScheduledAgent, error)
func (*APIClient) MarkRunStatus ¶ added in v0.11.494
func (*APIClient) SendAgentMessage ¶ added in v0.11.494
func (*APIClient) SetAgentPrompt ¶ added in v0.11.661
func (*APIClient) TriggerRun ¶ added in v0.11.494
func (c *APIClient) TriggerRun(ctx context.Context, project, pipeline, startDate, endDate string, opts TriggerRunOptions) error
TriggerRun triggers a pipeline run for the given date range.
func (*APIClient) UpdateAgent ¶ added in v0.11.667
func (c *APIClient) UpdateAgent(ctx context.Context, agentID int, fields map[string]any) (*Agent, error)
UpdateAgent patches an agent with the given fields. The caller decides which fields to include (based on which flags were set), so an explicit empty value is sent and can clear a field.
func (*APIClient) UpdateDashboard ¶ added in v0.11.679
func (c *APIClient) UpdateDashboard(ctx context.Context, dashboardID int, fields map[string]any) (*Dashboard, error)
UpdateDashboard applies a partial update to a dashboard. Only the fields present are changed; the definition (state) is written to the draft only (never published), same as create. Changing visibility requires manage-access on the server side.
func (*APIClient) UpdateScheduledAgent ¶ added in v0.11.682
func (c *APIClient) UpdateScheduledAgent(ctx context.Context, scheduledAgentID int, fields map[string]any) (*ScheduledAgent, error)
UpdateScheduledAgent applies a partial update to a scheduled agent's plan. Only the fields present are changed; activation is not updatable via the API.
type APIError ¶ added in v0.11.494
type APIError struct {
Message string `json:"message"`
Errors map[string][]string `json:"errors,omitempty"`
StatusCode int `json:"-"`
}
APIError represents an error response from the API.
type Agent ¶ added in v0.11.494
type Agent struct {
ID int `json:"id"`
Name string `json:"name"`
Description *string `json:"description"`
Visibility string `json:"visibility"`
}
Agent represents a Bruin Cloud agent.
type AgentMessage ¶ added in v0.11.494
type AgentMessage struct {
ID int `json:"id"`
Status string `json:"status"`
OutputMessage *string `json:"output_message"`
AgentLogs json.RawMessage `json:"agent_logs"`
QueryLogs json.RawMessage `json:"query_logs"`
OutputAttachments json.RawMessage `json:"output_attachments"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
AgentMessage represents a message in an agent thread.
type AgentPrompt ¶ added in v0.11.661
type AgentPrompt struct {
ID int `json:"id"`
Name string `json:"name"`
SystemPrompt *string `json:"system_prompt"`
}
AgentPrompt represents an agent's system prompt.
type AgentThread ¶ added in v0.11.494
type AgentThread struct {
ID int `json:"id"`
AgentID int `json:"agent_id"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
AgentThread represents a thread for an agent.
type Asset ¶ added in v0.11.494
type Asset struct {
Project string `json:"project"`
Pipeline string `json:"pipeline"`
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
URI string `json:"uri"`
Description *string `json:"description"`
Content *string `json:"content"`
Upstreams json.RawMessage `json:"upstreams"`
Downstream json.RawMessage `json:"downstream"`
Columns json.RawMessage `json:"columns"`
CustomChecks json.RawMessage `json:"custom_checks"`
Owner json.RawMessage `json:"owner"`
Materialization json.RawMessage `json:"materialization"`
Instance *string `json:"instance"`
Tags json.RawMessage `json:"tags"`
Connection *string `json:"connection"`
Image *string `json:"image"`
Parameters json.RawMessage `json:"parameters"`
Metadata json.RawMessage `json:"metadata"`
MarkdownDescription *string `json:"markdown_description"`
QualityScore int `json:"quality_score"`
MaxPossibleQualityScore int `json:"max_possible_quality_score"`
QualityScorePercentage int `json:"quality_score_percentage"`
}
Asset represents a pipeline asset.
type AssetInstance ¶ added in v0.11.494
type AssetInstance struct {
json.RawMessage
}
AssetInstance represents an asset instance within a pipeline run. The API returns dynamic JSON, so we use json.RawMessage for the full response.
type AssetInstanceCheck ¶ added in v0.11.494
type AssetInstanceCheck struct {
Name string `json:"name"`
Instance StepInstance `json:"instance"`
}
AssetInstanceCheck represents a named check with its step instance.
type AssetInstanceChecks ¶ added in v0.11.494
type AssetInstanceChecks struct {
Column []AssetInstanceCheck `json:"column"`
Custom []AssetInstanceCheck `json:"custom"`
}
AssetInstanceChecks represents checks for an asset instance.
type AssetInstanceInfo ¶ added in v0.11.494
type AssetInstanceInfo struct {
Asset string `json:"asset"`
Type string `json:"type"`
StartDate string `json:"startDate"`
EndDate string `json:"endDate"`
WallTimeDuration float64 `json:"wallTimeDuration"`
TotalExecutionDuration float64 `json:"totalExecutionDuration"`
Status string `json:"status"`
IsFinished bool `json:"isFinished"`
Steps AssetInstanceSteps `json:"steps"`
StepIDs []string `json:"stepIds"`
}
AssetInstanceInfo represents detailed information about an asset instance.
type AssetInstanceResponse ¶ added in v0.11.494
type AssetInstanceResponse struct {
Message string `json:"message"`
AssetInstances map[string]AssetInstanceInfo `json:"asset_instances"`
RunID string `json:"run_id"`
}
AssetInstanceResponse represents the parsed response from the asset instances endpoint.
type AssetInstanceSteps ¶ added in v0.11.494
type AssetInstanceSteps struct {
Main []StepInstance `json:"main"`
Checks AssetInstanceChecks `json:"checks"`
}
AssetInstanceSteps represents the steps of an asset instance.
type BruinCloudConfig ¶
type BruinCloudConfig interface {
GetIngestrURI() string
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetIngestrURI ¶
type Connection ¶ added in v0.11.635
Connection represents a Bruin Cloud connection (name and type only).
type Dashboard ¶ added in v0.11.667
type Dashboard struct {
ID int `json:"id"`
Title *string `json:"title"`
Visibility string `json:"visibility"`
UpdatedAt *string `json:"updated_at"`
URL string `json:"url"`
State json.RawMessage `json:"state,omitempty"`
}
Dashboard represents a Bruin Cloud dashboard. State is only populated by the single-dashboard endpoint and carries the published definition as raw JSON.
type GlossaryEntity ¶ added in v0.11.494
type GlossaryEntity struct {
json.RawMessage
}
GlossaryEntity represents a glossary entity. The API returns dynamic JSON structures, so we use json.RawMessage.
type LogEntry ¶ added in v0.11.494
type LogEntry struct {
json.RawMessage
}
LogEntry represents a log entry for an asset instance.
type Pipeline ¶ added in v0.11.494
type Pipeline struct {
Name string `json:"name"`
Description *string `json:"description"`
Schedule *string `json:"schedule"`
Assets json.RawMessage `json:"assets"`
Owner json.RawMessage `json:"owner"`
StartDate string `json:"start_date"`
Project string `json:"project"`
DefaultConnections json.RawMessage `json:"default_connections"`
Commit *string `json:"commit"`
Variables json.RawMessage `json:"variables"`
OxrScheduling *bool `json:"oxrScheduling"`
Status *string `json:"status"`
}
Pipeline represents a Bruin Cloud pipeline.
type PipelineRun ¶ added in v0.11.494
type PipelineRun struct {
Project string `json:"project"`
Pipeline string `json:"pipeline"`
RunID string `json:"run_id"`
DataIntervalStart json.RawMessage `json:"data_interval_start"`
DataIntervalEnd json.RawMessage `json:"data_interval_end"`
StartDate json.RawMessage `json:"start_date"`
EndDate json.RawMessage `json:"end_date"`
WallTimeDuration *float64 `json:"wall_time_duration"`
WallTimeDurationHumanized *string `json:"wall_time_duration_humanized"`
TotalExecutionDuration *float64 `json:"total_execution_duration"`
Status string `json:"status"`
UnknownInstanceCount int `json:"unknown_instance_count"`
Note *string `json:"note"`
}
PipelineRun represents a pipeline run.
type PipelineValidationError ¶ added in v0.11.494
type PipelineValidationError struct {
json.RawMessage
}
PipelineValidationError represents a pipeline validation error. The API returns dynamic JSON structures.
type Project ¶ added in v0.11.494
type Project struct {
ID string `json:"id"`
Name string `json:"name"`
Repo Repo `json:"repo"`
Rollouts json.RawMessage `json:"rollouts"`
}
Project represents a Bruin Cloud project.
type ScheduledAgent ¶ added in v0.11.682
type ScheduledAgent struct {
ID int `json:"id"`
Title *string `json:"title"`
IsActive bool `json:"is_active"`
ScheduleCron *string `json:"schedule_cron"`
ScheduleTimezone *string `json:"schedule_timezone"`
NextRunAt *string `json:"next_run_at"`
LastRunAt *string `json:"last_run_at"`
Instructions *string `json:"instructions"`
OutputFormatting *string `json:"output_formatting"`
VerifiedSqls json.RawMessage `json:"verified_sqls,omitempty"`
Memory json.RawMessage `json:"memory,omitempty"`
MonitorsDashboard json.RawMessage `json:"monitors_dashboard,omitempty"`
RecentExecutions json.RawMessage `json:"recent_executions,omitempty"`
}
ScheduledAgent represents a Bruin Cloud scheduled agent — a cron-based recurring agent task. The nested plan fields (verified SQLs, memory, ...) are kept as raw JSON so `--output json` round-trips the full server response faithfully.
type SendAgentMessageResponse ¶ added in v0.11.494
type SendAgentMessageResponse struct {
ThreadID int `json:"thread_id"`
MessageID int `json:"message_id"`
}
SendAgentMessageResponse represents the response from sending a message to an agent.
type StepInstance ¶ added in v0.11.494
type StepInstance struct {
Name string `json:"name"`
StepID string `json:"stepId"`
StartDate string `json:"startDate"`
EndDate string `json:"endDate"`
Duration float64 `json:"duration"`
TryNumber int `json:"tryNumber"`
Status string `json:"status"`
IsFinished bool `json:"isFinished"`
}
StepInstance represents a step or check instance.