operatorv1

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package operatorv1 defines the provider-neutral Operator V1 domain contract.

Index

Constants

View Source
const APIVersion = "brokerkit.io/operator/v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string
const (
	ActionApprove Action = "approve"
	ActionDeny    Action = "deny"
	ActionRevoke  Action = "revoke"
)

type ApprovalBounds

type ApprovalBounds struct {
	MaxDurationSeconds int64           `json:"max_duration_seconds"`
	MaxUses            usebudget.Limit `json:"max_uses"`
}

type Constraints

type Constraints struct {
	DurationSeconds int64              `json:"duration_seconds,omitempty"`
	MaxUses         usebudget.Optional `json:"max_uses,omitempty"`
}

type Decision

type Decision struct {
	ExpectedRevision int64        `json:"expected_revision"`
	IdempotencyKey   string       `json:"idempotency_key"`
	OnBehalfOf       string       `json:"on_behalf_of,omitempty"`
	Constraints      *Constraints `json:"constraints,omitempty"`
}

type Descriptor

type Descriptor struct {
	APIVersion string `json:"api_version"`
}

type Error

type Error struct {
	Code          string   `json:"code"`
	Message       string   `json:"message"`
	CorrelationID string   `json:"correlation_id"`
	Current       *Request `json:"current,omitempty"`
}

type ErrorEnvelope

type ErrorEnvelope struct {
	Error Error `json:"error"`
}

type Event

type Event struct {
	Cursor     string        `json:"cursor"`
	Kind       string        `json:"kind"`
	RequestID  string        `json:"request_id"`
	Revision   int64         `json:"revision"`
	Status     grants.Status `json:"status"`
	OccurredAt time.Time     `json:"occurred_at"`
	UsedCount  int           `json:"used_count"`
}

type EventStream

type EventStream interface {
	Receive(context.Context) (Event, error)
	Close() error
}

EventStream is one source event stream. Receive blocks until an event or error.

type Fact

type Fact struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

type Page

type Page struct {
	Requests    []Request `json:"requests"`
	NextCursor  string    `json:"next_cursor,omitempty"`
	EventCursor string    `json:"event_cursor,omitempty"`
}

type Presentation

type Presentation struct {
	Risk    string `json:"risk"`
	Title   string `json:"title"`
	Summary string `json:"summary,omitempty"`
	Facts   []Fact `json:"facts,omitempty"`
}

type Query

type Query struct {
	Status    grants.StatusGroup
	Requester string
	Operation string
	Target    *policy.Target
	Cursor    string
	Limit     int
}

type Request

type Request struct {
	ID                       string          `json:"id"`
	Revision                 int64           `json:"revision"`
	Requester                string          `json:"requester"`
	Operation                string          `json:"operation"`
	Status                   grants.Status   `json:"status"`
	RequestedAt              time.Time       `json:"requested_at"`
	PendingExpiresAt         *time.Time      `json:"pending_expires_at,omitempty"`
	ActiveExpiresAt          *time.Time      `json:"active_expires_at,omitempty"`
	RequestedDurationSeconds int64           `json:"requested_duration_seconds"`
	RequestedMaxUses         usebudget.Limit `json:"requested_max_uses"`
	GrantedMaxUses           usebudget.Limit `json:"granted_max_uses"`
	UsedCount                int             `json:"used_count"`
	RequestReason            string          `json:"request_reason,omitempty"`
	DecidedAt                *time.Time      `json:"decided_at,omitempty"`
	DecidedBy                string          `json:"decided_by,omitempty"`
	DecidedOnBehalfOf        string          `json:"decided_on_behalf_of,omitempty"`
	Presentation             Presentation    `json:"presentation"`
	PresentationUnavailable  bool            `json:"presentation_unavailable,omitempty"`
	AllowedActions           []Action        `json:"allowed_actions"`
	ApprovalBounds           *ApprovalBounds `json:"approval_bounds,omitempty"`
}

type Source

Source is the complete provider-neutral trusted-host client contract.

Jump to

Keyboard shortcuts

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