Help us shape the future of Go! Take the 2026 Go Developer Survey

act

package
v1.4.32 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RiskLow    Risk = "low"
	RiskMedium Risk = "medium"
	RiskHigh   Risk = "high"

	DecisionAllow Decision = "allow"
	DecisionAsk   Decision = "ask"
	DecisionDeny  Decision = "deny"
)

Variables

View Source
var ErrActionDenied = errors.New("action denied")
View Source
var ErrReadOnlyApproval = errors.New("created before the upgrade; propose again")

Functions

This section is empty.

Types

type ActionType

type ActionType string

type Adapter

type Adapter interface {
	Type() ActionType
	Destructive() bool
	Schema() map[string]any
	Validate(context.Context, Proposal) error
	DryRun(context.Context, Proposal) (string, error)
	Execute(context.Context, Proposal) (Result, error)
	Verify(context.Context, Proposal, Result) (Verification, error)
}

type Approval

type Approval struct {
	ReadOnly               bool          `json:"read_only,omitempty"`
	ID                     string        `json:"id"`
	Proposal               Proposal      `json:"proposal"`
	State                  string        `json:"state"`
	Approver               string        `json:"approver,omitempty"`
	ExpiresAt              time.Time     `json:"expires_at"`
	ClaimedAt              time.Time     `json:"claimed_at,omitempty"`
	ReconciliationRequired bool          `json:"reconciliation_required,omitempty"`
	ExecutedAt             time.Time     `json:"executed_at,omitempty"`
	VerifiedAt             time.Time     `json:"verified_at,omitempty"`
	Result                 *Result       `json:"result,omitempty"`
	Verified               *Verification `json:"verification,omitempty"`
}

type Authorizer

type Authorizer interface {
	Authorize(context.Context, string, Proposal) error
}

type Decision

type Decision string

type Guide

type Guide struct {
	Action  string `json:"action"`
	Command string `json:"command"`
	Risk    string `json:"risk"`
}

type PermissionAuthorizer

type PermissionAuthorizer struct{}

func (PermissionAuthorizer) Authorize

func (PermissionAuthorizer) Authorize(ctx context.Context, approver string, proposal Proposal) error

type Proposal

type Proposal struct {
	ID          string          `json:"id"`
	RunID       string          `json:"run_id"`
	Type        ActionType      `json:"type"`
	Target      TargetRef       `json:"target"`
	Params      json.RawMessage `json:"params"`
	ParamsHash  string          `json:"params_hash"`
	BindingHash string          `json:"binding_hash"`
	DryRun      string          `json:"dry_run"`
	Risk        Risk            `json:"risk"`
	Reason      string          `json:"reason"`
	ProposedBy  string          `json:"proposed_by"`
	CreatedAt   time.Time       `json:"created_at"`
	ExpiresAt   time.Time       `json:"expires_at"`
}

type ProposalBinder

type ProposalBinder interface {
	Bind(context.Context, Proposal) (json.RawMessage, error)
}

type ProposalInput

type ProposalInput struct {
	Type   ActionType      `json:"type"`
	Target TargetRef       `json:"target"`
	Params json.RawMessage `json:"params"`
	Reason string          `json:"reason"`
}

type ProposalResult

type ProposalResult struct {
	Proposal *Proposal `json:"proposal,omitempty"`
	Approval *Approval `json:"approval,omitempty"`
	Nonce    string    `json:"nonce,omitempty"`
	Guide    *Guide    `json:"guide,omitempty"`
}

type ProposalTool

type ProposalTool struct {
	Service *Service
}

func (ProposalTool) ArgsSchema

func (ProposalTool) ArgsSchema() map[string]any

func (ProposalTool) Description

func (ProposalTool) Description() string

func (ProposalTool) Invoke

func (tool ProposalTool) Invoke(ctx context.Context, args json.RawMessage) (*core.ToolResult, error)

func (ProposalTool) Name

func (ProposalTool) Name() string

type ReadTargetResolver added in v1.4.31

type ReadTargetResolver interface {
	ResolveReadTarget(TargetRef) (TargetRef, error)
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Lookup

func (registry *Registry) Lookup(actionType ActionType) (Adapter, bool)

func (*Registry) Register

func (registry *Registry) Register(adapter Adapter) error

type Result

type Result struct {
	Summary  string          `json:"summary,omitempty"`
	Metadata json.RawMessage `json:"metadata,omitempty"`
}

type Risk

type Risk string

type Service

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

func NewService

func NewService(provider storage.Provider, org string, writer ledger.Writer, authorizer Authorizer, adapters ...Adapter) (*Service, error)

func NewServiceWithScope added in v1.4.31

func NewServiceWithScope(provider storage.Provider, scope tenancy.OrgScope, writer ledger.Writer, authorizer Authorizer, adapters ...Adapter) (*Service, error)

func (*Service) Approvals

func (service *Service) Approvals(ctx context.Context, pendingOnly bool) ([]Approval, error)

func (*Service) Approve

func (service *Service) Approve(ctx context.Context, approvalID, nonce, approver string) (Approval, error)

func (*Service) Available added in v1.4.31

func (service *Service) Available() bool

func (*Service) Propose

func (service *Service) Propose(ctx context.Context, input ProposalInput) (ProposalResult, error)

func (*Service) Reject

func (service *Service) Reject(ctx context.Context, approvalID, reason, approver string) (Approval, error)

type TargetRef

type TargetRef struct {
	Cluster   string `json:"cluster,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	Kind      string `json:"kind"`
	Name      string `json:"name"`
}

type TargetResolver added in v1.4.31

type TargetResolver interface {
	ResolveTarget(TargetRef) (TargetRef, error)
}

type Verification

type Verification struct {
	Verified bool   `json:"verified"`
	Summary  string `json:"summary"`
}

Directories

Path Synopsis
adapters
k8s

Jump to

Keyboard shortcuts

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