clawapi

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VerbFleetStatus        = "fleet.status"
	VerbFleetLogs          = "fleet.logs"
	VerbFleetQueryMetrics  = "fleet.query_metrics"
	VerbFleetAlerts        = "fleet.alerts"
	VerbFleetRestart       = "fleet.restart"
	VerbFleetQuarantine    = "fleet.quarantine"
	VerbFleetBudgetSet     = "fleet.budget.set"
	VerbFleetModelRestrict = "fleet.model.restrict"
)

Variables

View Source
var AllVerbs = append(append([]string{}, AllReadVerbs...), AllWriteVerbs...)

Functions

func GenerateServiceSkill

func GenerateServiceSkill(port string) string

func GenerateToken

func GenerateToken() (string, error)

Types

type Principal

type Principal struct {
	Name            string   `json:"name"`
	Token           string   `json:"token"`
	Verbs           []string `json:"verbs"`
	Pods            []string `json:"pods,omitempty"`
	Services        []string `json:"services,omitempty"`
	ClawIDs         []string `json:"claw_ids,omitempty"`
	ComposeServices []string `json:"compose_services,omitempty"`
}

func BuildMasterPrincipal

func BuildMasterPrincipal(podName, principalName string) (Principal, error)

func BuildSelfPrincipal added in v0.3.6

func BuildSelfPrincipal(podName, serviceName string) (Principal, error)

func (*Principal) AllowsClawID

func (p *Principal) AllowsClawID(podName, clawID string) bool

func (*Principal) AllowsComposeService added in v0.3.6

func (p *Principal) AllowsComposeService(podName, composeName string) bool

func (*Principal) AllowsPod

func (p *Principal) AllowsPod(podName string) bool

func (*Principal) AllowsService

func (p *Principal) AllowsService(podName, service string) bool

func (*Principal) AllowsVerb

func (p *Principal) AllowsVerb(verb string) bool

type Store

type Store struct {
	Principals []Principal `json:"principals"`
}

func LoadStore

func LoadStore(filePath string) (*Store, error)

func (*Store) ResolveBearer

func (s *Store) ResolveBearer(header string) (*Principal, error)

type ThresholdAlert added in v0.3.5

type ThresholdAlert struct {
	Type     string `json:"type"`
	Severity string `json:"severity"`
	Summary  string `json:"summary"`
}

type Thresholds added in v0.3.5

type Thresholds struct {
	ErrorRatePercent     float64 `json:"error_rate_percent"`
	MaxCostUSD           float64 `json:"max_cost_usd"`
	FeedErrorRatePercent float64 `json:"feed_error_rate_percent"`
	InterventionCount    int     `json:"intervention_count"`
}

func DefaultThresholds added in v0.3.5

func DefaultThresholds() Thresholds

func ThresholdsFromEnv added in v0.3.5

func ThresholdsFromEnv() Thresholds

func (Thresholds) Evaluate added in v0.3.5

func (th Thresholds) Evaluate(agent audit.AgentSummary) []ThresholdAlert

Jump to

Keyboard shortcuts

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