bruincloud

package
v0.11.689 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

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

func NewAPIClient(apiKey string) *APIClient

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 (c *APIClient) CreateConnection(ctx context.Context, name, connType string, credentials map[string]any) error

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 (c *APIClient) DeleteConnection(ctx context.Context, name string) error

func (*APIClient) DeletePipeline added in v0.11.494

func (c *APIClient) DeletePipeline(ctx context.Context, project, pipeline string) error

func (*APIClient) DisablePipeline added in v0.11.494

func (c *APIClient) DisablePipeline(ctx context.Context, project, pipeline string) error

func (*APIClient) EnablePipeline added in v0.11.494

func (c *APIClient) EnablePipeline(ctx context.Context, project, pipeline string) error

func (*APIClient) GetAgent added in v0.11.667

func (c *APIClient) GetAgent(ctx context.Context, agentID int) (*Agent, error)

GetAgent returns a single agent's details.

func (*APIClient) GetAgentMessageStatus added in v0.11.494

func (c *APIClient) GetAgentMessageStatus(ctx context.Context, agentID, threadID, messageID int) (*AgentMessage, error)

func (*APIClient) GetAgentPrompt added in v0.11.661

func (c *APIClient) GetAgentPrompt(ctx context.Context, agentID int) (*AgentPrompt, error)

func (*APIClient) GetAsset added in v0.11.494

func (c *APIClient) GetAsset(ctx context.Context, project, pipeline, asset string) (*Asset, error)

func (*APIClient) GetDashboard added in v0.11.667

func (c *APIClient) GetDashboard(ctx context.Context, dashboardID int) (*Dashboard, error)

func (*APIClient) GetGlossaryEntity added in v0.11.494

func (c *APIClient) GetGlossaryEntity(ctx context.Context, project, entityName string) (json.RawMessage, error)

func (*APIClient) GetInstance added in v0.11.494

func (c *APIClient) GetInstance(ctx context.Context, project, pipeline, runID, assetName string) (json.RawMessage, error)

func (*APIClient) GetInstanceLogs added in v0.11.494

func (c *APIClient) GetInstanceLogs(ctx context.Context, project, pipeline, runID, stepID string, tryNumber int) (json.RawMessage, error)

func (*APIClient) GetLatestRun added in v0.11.494

func (c *APIClient) GetLatestRun(ctx context.Context, project, pipeline string) (*PipelineRun, error)

func (*APIClient) GetPipeline added in v0.11.494

func (c *APIClient) GetPipeline(ctx context.Context, project, name string) (*Pipeline, error)

func (*APIClient) GetPipelineErrors added in v0.11.494

func (c *APIClient) GetPipelineErrors(ctx context.Context) ([]json.RawMessage, error)

func (*APIClient) GetRun added in v0.11.494

func (c *APIClient) GetRun(ctx context.Context, project, pipeline, runID string) (*PipelineRun, error)

func (*APIClient) GetScheduledAgent added in v0.11.682

func (c *APIClient) GetScheduledAgent(ctx context.Context, scheduledAgentID int) (*ScheduledAgent, error)

func (*APIClient) ListAgentMessages added in v0.11.494

func (c *APIClient) ListAgentMessages(ctx context.Context, agentID, threadID int, limit, offset int) ([]AgentMessage, error)

func (*APIClient) ListAgentThreads added in v0.11.494

func (c *APIClient) ListAgentThreads(ctx context.Context, agentID int, limit, offset int) ([]AgentThread, error)

func (*APIClient) ListAgents added in v0.11.494

func (c *APIClient) ListAgents(ctx context.Context) ([]Agent, error)

func (*APIClient) ListAssets added in v0.11.494

func (c *APIClient) ListAssets(ctx context.Context, project, pipeline string) ([]Asset, error)

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 (c *APIClient) ListDashboards(ctx context.Context) ([]Dashboard, error)

func (*APIClient) ListGlossaryEntities added in v0.11.494

func (c *APIClient) ListGlossaryEntities(ctx context.Context) (json.RawMessage, error)

func (*APIClient) ListInstances added in v0.11.494

func (c *APIClient) ListInstances(ctx context.Context, project, pipeline, runID string) (json.RawMessage, error)

func (*APIClient) ListInstancesParsed added in v0.11.494

func (c *APIClient) ListInstancesParsed(ctx context.Context, project, pipeline, runID string) (*AssetInstanceResponse, error)

func (*APIClient) ListPipelines added in v0.11.494

func (c *APIClient) ListPipelines(ctx context.Context) ([]Pipeline, error)

func (*APIClient) ListProjects added in v0.11.494

func (c *APIClient) ListProjects(ctx context.Context) ([]Project, error)

func (*APIClient) ListRuns added in v0.11.494

func (c *APIClient) ListRuns(ctx context.Context, project, pipeline string, limit, offset int) ([]PipelineRun, error)

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 (c *APIClient) MarkRunStatus(ctx context.Context, project, pipeline, runID, status string) error

func (*APIClient) RerunRun added in v0.11.494

func (c *APIClient) RerunRun(ctx context.Context, project, pipeline, runID string, onlyFailed bool) error

func (*APIClient) SendAgentMessage added in v0.11.494

func (c *APIClient) SendAgentMessage(ctx context.Context, agentID int, message string, threadID *int) (json.RawMessage, error)

func (*APIClient) SetAgentPrompt added in v0.11.661

func (c *APIClient) SetAgentPrompt(ctx context.Context, agentID int, systemPrompt string) (*AgentPrompt, error)

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.

func (*APIError) Error added in v0.11.494

func (e *APIError) Error() string

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 NewClient

func NewClient(c Config) (*Client, error)

func (*Client) GetIngestrURI

func (c *Client) GetIngestrURI() (string, error)

type Config

type Config struct {
	APIToken string
}

func (*Config) GetIngestrURI

func (c *Config) GetIngestrURI() string

type Connection added in v0.11.635

type Connection struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

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 Repo added in v0.11.494

type Repo struct {
	URL    string `json:"url"`
	Branch string `json:"branch"`
}

Repo represents a git repository configuration.

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.

type TriggerRunOptions added in v0.11.631

type TriggerRunOptions struct {
	Assets      []string
	Downstream  bool
	FullRefresh bool
	Split       string
	ChunkSize   int
	Variables   map[string]any
	Note        string
	Tags        []string
}

TriggerRunOptions holds the optional parameters the trigger endpoint accepts.

Jump to

Keyboard shortcuts

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