resources

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package resources owns the per-user inventory and management surface for reusable connections, MCP servers, and exec endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	AgentID        uuid.UUID
	AgentName      string
	AgentSlug      string
	NeedType       string
	NeedSlug       string
	CanAccessAgent bool
}

Consumer identifies an agent need bound to a resource.

type Resource

type Resource struct {
	ID           uuid.UUID
	Type         string // connection | mcp_server | exec_endpoint
	Slug         string
	Name         string
	DisplayName  string
	AuthMode     string
	Authorized   bool
	AgentCount   int32
	Capabilities []string
	CreatedAt    pgtype.Timestamptz
	LastUsedAt   pgtype.Timestamptz
}

Resource is one resource available to the caller through ownership or a grant. It carries no secret material.

type Service

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

func New

func New(d *db.DB, logger *zap.Logger) *Service

func (*Service) Consumers

func (s *Service) Consumers(ctx context.Context, p authz.Principal, typ string, id uuid.UUID) ([]Consumer, error)

Consumers lists every agent need bound to a resource. Resource view capability is required; agent membership is not, because the grant controls visibility of this resource-level relationship.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, p authz.Principal, typ string, id uuid.UUID) error

Delete removes a resource. Grants cascade and bound needs become unbound.

func (*Service) List

func (s *Service) List(ctx context.Context, p authz.Principal) ([]Resource, error)

List returns resources available through ownership or a resource grant and exposes the caller's capabilities on each one.

func (*Service) Rename

func (s *Service) Rename(ctx context.Context, p authz.Principal, typ string, id uuid.UUID, displayName string) error

Rename updates a resource's non-unique user-controlled display name.

func (*Service) Revoke

func (s *Service) Revoke(ctx context.Context, p authz.Principal, typ string, id uuid.UUID) error

Revoke clears stored credentials. Resource manage capability is required.

Jump to

Keyboard shortcuts

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