operatorinbox

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: 9 Imported by: 0

Documentation

Overview

Package operatorinbox projects durable grants into bounded, operator-safe records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditSummary

type AuditSummary = LabeledValue

AuditSummary is one safe, bounded audit fact.

type DisplayField

type DisplayField = LabeledValue

DisplayField is one bounded provider-specific display value.

type Item

type Item struct {
	ID                       string          `json:"id"`
	Revision                 int64           `json:"revision"`
	Client                   string          `json:"client"`
	Operation                string          `json:"operation"`
	Status                   grants.Status   `json:"status"`
	RequestedAt              time.Time       `json:"requested_at"`
	PendingExpiresAt         time.Time       `json:"pending_expires_at"`
	ActiveExpiresAt          *time.Time      `json:"active_expires_at,omitempty"`
	RequestedDurationSeconds int64           `json:"requested_duration_seconds"`
	RequestedMaxUses         usebudget.Limit `json:"requested_max_uses"`
	MaxUses                  usebudget.Limit `json:"max_uses"`
	UsedCount                int             `json:"used_count"`
	ReservedCount            int             `json:"reserved_count"`
	Reason                   string          `json:"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"`
}

Item is the only grant representation exposed by the operator HTTP API.

type LabeledValue

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

LabeledValue is one bounded operator-facing display fact.

type Page

type Page struct {
	Items       []Item `json:"items"`
	NextCursor  string `json:"next_cursor,omitempty"`
	HasMore     bool   `json:"has_more"`
	EventCursor string `json:"event_cursor,omitempty"`
}

Page is one bounded inbox result.

type Presentation

type Presentation struct {
	Risk     Risk           `json:"risk"`
	Title    string         `json:"title"`
	Summary  string         `json:"summary,omitempty"`
	Target   string         `json:"target"`
	Fields   []DisplayField `json:"fields,omitempty"`
	PlanHash string         `json:"plan_hash,omitempty"`
	Audit    []AuditSummary `json:"audit,omitempty"`
}

Presentation is the provider-owned safe display projection.

type Presenter

type Presenter interface {
	Present(context.Context, grants.Grant) (Presentation, error)
}

Presenter converts a canonical grant into display-only provider wording.

type PresenterFunc

type PresenterFunc func(context.Context, grants.Grant) (Presentation, error)

PresenterFunc adapts a function to Presenter.

func (PresenterFunc) Present

func (f PresenterFunc) Present(ctx context.Context, grant grants.Grant) (Presentation, error)

type Risk

type Risk string

Risk is a provider-supplied display classification with a fixed vocabulary.

const (
	RiskUnknown  Risk = "unknown"
	RiskLow      Risk = "low"
	RiskMedium   Risk = "medium"
	RiskHigh     Risk = "high"
	RiskCritical Risk = "critical"
)

type Service

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

Service joins the durable store with one broker-owned presenter.

func New

func New(store *grants.Store, presenter Presenter) (*Service, error)

New constructs an inbox service. A nil presenter uses safe generic wording.

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (Item, error)

Get returns one safe record by durable grant ID.

func (*Service) List

func (s *Service) List(ctx context.Context, query grants.Query) (Page, error)

List returns bounded safe records matching query.

func (*Service) Project

func (s *Service) Project(ctx context.Context, grant grants.Grant) Item

Project creates a safe item from an authoritative grant returned by a transition.

func (*Service) Store

func (s *Service) Store() *grants.Store

Store exposes the durable store to the shared HTTP transport.

Jump to

Keyboard shortcuts

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