catalogapi

package
v1.146.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package catalogapi is the portal's REST surface over the platform catalog (#1921): finding and browsing datasets, reading a dataset with its columns, curation, lineage and history, editing that curation, and the glossary, tags, domains and data products it is curated with.

Reading the catalog takes the persona's fetch grant and writing it the apply_knowledge grant, the two tools that read and curate it over MCP, so the portal never shows or changes more than the persona-filtered MCP surface would. A dataset, its columns and its schema document belong to a connection, and are read and written only by a caller whose persona reaches that connection. An administrator reaches everything.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AspectWrite

type AspectWrite struct {
	Reference string             `json:"reference"`
	Aspect    catalog.AspectName `json:"aspect"`
	// Value is the aspect's new value in its own shape; null clears it.
	Value json.RawMessage `json:"value" swaggertype:"object"`
	// Expect, when present, is the value the writer read the aspect as (null
	// for absent). The write is refused with 409 when the aspect holds
	// anything else, so a value built from a stale read never replaces a
	// write made since.
	Expect json.RawMessage `json:"expect,omitempty" swaggertype:"object"`
}

AspectWrite is one aspect value to write.

type BrowseLevel

type BrowseLevel struct {
	Entries []catalog.BrowseEntry `json:"entries"`
}

BrowseLevel is one level of a connection's datasets.

type Connection

type Connection struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
}

Connection is one connection the catalog holds datasets for.

type ConnectionList

type ConnectionList struct {
	Connections []Connection `json:"connections"`
	Writable    bool         `json:"writable"`
}

ConnectionList is the connections the caller may browse, and whether the caller may edit the catalog.

type DatasetList

type DatasetList struct {
	Results []catalog.DatasetSummary `json:"results"`
}

DatasetList is one page of datasets.

type DatasetView

type DatasetView struct {
	*catalog.Dataset
	Upstream   []catalog.Hop `json:"upstream"`
	Downstream []catalog.Hop `json:"downstream"`
	// Names maps each glossary term and domain reference the curation holds
	// to its display name.
	Names    map[string]string `json:"names"`
	Writable bool              `json:"writable"`
}

DatasetView is a dataset as the dataset page shows it: its columns and curation, the lineage around it the caller may see, the names of the definitions its curation refers to, and whether the caller may edit it.

type DefinitionCreate

type DefinitionCreate struct {
	Kind catalog.Kind `json:"kind"`
	Name string       `json:"name"`
	// Parent is the glossary node a term or node is placed under.
	Parent      string `json:"parent,omitempty"`
	Description string `json:"description,omitempty"`
}

DefinitionCreate is a definition to create.

type DefinitionList

type DefinitionList struct {
	Results []catalog.DefinitionSummary `json:"results"`
}

DefinitionList is one page of definitions.

type DefinitionView

type DefinitionView struct {
	*catalog.Definition
	Children []catalog.DefinitionSummary `json:"children"`
	Uses     []catalog.Use               `json:"uses"`
	// UsesWithheld counts the carriers on connections the persona does not
	// reach.
	UsesWithheld int `json:"uses_withheld"`
	// MoreUses is set when more datasets and columns carry the definition than
	// the page lists.
	MoreUses bool `json:"more_uses"`
	Writable bool `json:"writable"`
}

DefinitionView is a definition as its page shows it: the definition, the glossary entries under a node, the datasets and columns that carry a term, tag or domain the caller's persona reaches, and whether the caller may edit it.

type Deps

type Deps struct {
	Store Store
	// Connections lists the connections the catalog holds datasets for.
	Connections func() []Connection
	// PersonaResolver resolves a caller's roles to the persona's tools and
	// connection reach; nil leaves the catalog to administrators.
	PersonaResolver portal.PersonaResolver
	AdminRoles      []string
	// Audit records each write; nil records none.
	Audit audit.Logger
}

Deps holds what the handler reads and writes through.

type Handler

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

Handler serves the portal catalog routes.

func New

func New(deps Deps) *Handler

New returns the handler.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux)

Register mounts the routes on the portal mux, behind the portal's own authentication.

type History

type History struct {
	Changes []catalog.Change `json:"changes"`
}

History is the changes to an entity's curation, newest first.

type RollbackRequest

type RollbackRequest struct {
	Reference string             `json:"reference"`
	Aspect    catalog.AspectName `json:"aspect"`
	ChangeID  string             `json:"change_id"`
}

RollbackRequest names the change to undo and the entity and aspect it belongs to.

type SchemaDocumentView

type SchemaDocumentView struct {
	*catalog.SchemaDocument
	Content string `json:"content"`
}

SchemaDocumentView is a schema document with its content as text.

type Store

type Store interface {
	catalog.Store
	GetDocument(ctx context.Context, ref catalog.Ref) (*catalog.SchemaDocument, error)
}

Store is the catalog the handler reads and writes, with the connections' schema documents. catalogstore.Store implements it.

Jump to

Keyboard shortcuts

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