exportlibrary

package
v1.147.0 Latest Latest
Warning

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

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

Documentation

Overview

Package exportlibrary is the library a managed script's "resources" export files its output in (#2080): platform.export's scope= and scope_id=, read the way manage_resource reads the same pair. Without scope the output lands in the library of the person the run acts for; with one it lands in the library scope names, and whether the run may write there is the resource rule (resource.CanWriteScope) against the identity the run presents, checked when the script is saved and again when the file is written.

It is kept out of internal/platform/scriptrun for that package's size budget, as exporttable and exportrefs are: the argument's rules and its static read live here, and the engine and the validator call them.

Index

Constants

This section is empty.

Variables

View Source
var ErrIndexNotLibrary = errors.New(`index is how the managed-resource library indexes a file; it applies to destination="resources" only`)

ErrIndexNotLibrary is index= given to a destination that files nothing in the library.

View Source
var ErrNotLibrary = errors.New(`scope and scope_id name a library, and only the "resources" destination files an output in one`)

ErrNotLibrary is a scope given to a destination that files nothing in a library.

Functions

func Check

func Check(scope, scopeID string) error

Check checks the scope and scope_id an export names, the same pair manage_resource takes: both empty is the run's own library.

func CheckArgs added in v1.145.0

func CheckArgs(library bool, scope, scopeID, index string) (string, error)

CheckArgs is CheckFor and index= together (#2111): index says how search indexes the file, which only a library file has. It returns the policy index names, empty when it names none.

func CheckFor

func CheckFor(library bool, scope, scopeID string) error

CheckFor checks the scope and scope_id an export names against whether its destination files in a library: none named is always fine.

func FromCall

func FromCall(call *syntax.CallExpr, read Reader, resources string) (*Library, *Finding)

FromCall reads the library one platform.export call files in. It returns the library for a "resources" export whose scope arguments are written out, nil for one that files in no library or whose destination is computed, and a Finding for scope arguments a reader cannot state: computed, naming no library, or given to a destination that files in none. resources is the built-in destination's name.

Types

type Finding

type Finding struct {
	Message string
	Hint    string
}

Finding is what a source's export says that names no library a reader can state: the message, and the hint that says what to write.

type Library

type Library struct {
	Scope   string `json:"scope"`
	ScopeID string `json:"scope_id,omitempty"`
}

Library is one library a script's "resources" exports write to, as the source names it: Scope empty is the library of the person the run acts for.

func Sorted

func Sorted(set map[Library]bool) []Library

Sorted returns the libraries in a stable order, never nil.

func (Library) Label

func (l Library) Label() string

Label names the library the way a refusal and a reader of the reach do.

func (Library) Normalized

func (l Library) Normalized() Library

Normalized states the run's own library one way: scope="user" with no scope_id is the same library as no scope at all.

func (Library) Own

func (l Library) Own() bool

Own reports whether the library is the one the run acts for, which a run can always write to.

func (Library) RecordScope

func (l Library) RecordScope() (scope, scopeID string)

RecordScope is the library as an export record states it: the scope, and "user" with no id for the run's own.

type Reader

type Reader func(syntax.Expr) (string, bool)

Reader reads an argument as the string it is written as, directly or through a module constant, reporting whether it is one.

Jump to

Keyboard shortcuts

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