Documentation
¶
Index ¶
- Constants
- Variables
- func FetchAllCursorPages[T any](ac *client.AlpaconClient, endpoint string, params map[string]string) ([]T, error)
- func FetchAllPages[T any](ac *client.AlpaconClient, endpoint string, params map[string]string) ([]T, error)
- func FetchAllPagesWithContext[T any](ctx context.Context, ac *client.AlpaconClient, endpoint string, ...) ([]T, error)
- func FetchCursorPages[T any](ac *client.AlpaconClient, endpoint string, params map[string]string, limit int) ([]T, error)
- func FetchPagesUpTo[T any](ac *client.AlpaconClient, endpoint string, params map[string]string, limit int) ([]T, error)
- func IDURL(base string, id PathID, action string, params map[string]string) string
- func RequireName(name, blankMsg string) (string, error)
- func ResolveByName[T any](ac *client.AlpaconClient, opts ResolveByNameOptions) (*T, error)
- func ResolveByNameWithContext[T any](ctx context.Context, ac *client.AlpaconClient, opts ResolveByNameOptions) (*T, error)
- type CursorListResponse
- type ListResponse
- type PathID
- type Reach
- type ResolveByNameOptions
Constants ¶
const ( // ReachOrg is the whole workspace, within whatever window the trail documents. ReachOrg = "org" // ReachBound is the part of the workspace the reader's bindings reach. ReachBound = "bound" // ReachSelf is only the rows that name the reader. ReachSelf = "self" // ReachNone is nothing: the reader may not read the trail. ReachNone = "none" )
The reach values an audit list's envelope states. The set is open: a server may send one this build does not know, which a caller must show as sent and never read as complete.
Variables ¶
var ErrBlankName = errors.New("blank name")
ErrBlankName marks a resolver's refusal of a name that trims to empty, so a caller can tell it apart from an ordinary not-found with errors.Is instead of matching message text.
var ErrNotFound = errors.New("not found")
ErrNotFound marks a resolver's miss: the lookup answered and no resource has that name. A request that failed never carries it.
var ErrUnusableID = errors.New("unusable ID in server response")
ErrUnusableID marks an ID from a server response that cannot safely be used as a path segment.
Functions ¶
func FetchAllCursorPages ¶ added in v1.16.0
func FetchAllCursorPages[T any](ac *client.AlpaconClient, endpoint string, params map[string]string) ([]T, error)
FetchAllCursorPages walks every cursor page. It is FetchCursorPages with no bound.
func FetchAllPages ¶ added in v1.0.0
func FetchAllPages[T any](ac *client.AlpaconClient, endpoint string, params map[string]string) ([]T, error)
FetchAllPages walks every page. It is FetchPagesUpTo with no bound.
func FetchAllPagesWithContext ¶ added in v1.20.2
func FetchAllPagesWithContext[T any](ctx context.Context, ac *client.AlpaconClient, endpoint string, params map[string]string) ([]T, error)
FetchAllPagesWithContext is FetchAllPages ended early by ctx.
func FetchCursorPages ¶ added in v1.9.2
func FetchCursorPages[T any](ac *client.AlpaconClient, endpoint string, params map[string]string, limit int) ([]T, error)
FetchCursorPages follows the Elasticsearch cursor contract, accumulating up to limit items. A walk that fails with an error accepted by isRestartableCursorError restarts from the first page, up to cursorRestartLimit times.
On failure the items collected so far come back alongside the error. They are one walk's items, never spliced across restarts. Only a nil error means the walk finished, so a caller that shows items it got with an error must say they are partial.
func FetchPagesUpTo ¶ added in v1.11.0
func FetchPagesUpTo[T any](ac *client.AlpaconClient, endpoint string, params map[string]string, limit int) ([]T, error)
FetchPagesUpTo walks PageNumber pages until it has limit items, so a caller asking for more than one page's worth is not silently cut off at the server's page cap.
func IDURL ¶ added in v1.17.0
IDURL builds base/id/action/ with params as the query. action is one constant segment such as "close", or "" for none. It panics on a base that does not parse, as on a bad action: every base is a route this module declares.
func RequireName ¶ added in v1.13.2
RequireName trims name and refuses it if empty, returning an error satisfying errors.Is(err, ErrBlankName) with blankMsg as its message.
func ResolveByName ¶ added in v1.13.2
func ResolveByName[T any](ac *client.AlpaconClient, opts ResolveByNameOptions) (*T, error)
ResolveByName looks up a single resource through a server-side, exact-match name filter. A blank name is refused up front—an empty filter comes back as the whole list, not "found".
func ResolveByNameWithContext ¶ added in v1.20.2
func ResolveByNameWithContext[T any](ctx context.Context, ac *client.AlpaconClient, opts ResolveByNameOptions) (*T, error)
ResolveByNameWithContext is ResolveByName ended early by ctx.
Types ¶
type CursorListResponse ¶ added in v1.9.2
CursorListResponse decodes the Elasticsearch cursor-pagination contract (base64 next token, not ListResponse's int page).
type ListResponse ¶
type PathID ¶ added in v1.17.0
type PathID struct {
// contains filtered or unexported fields
}
PathID is an ID that passed RequireID or RequireResponseID, the only way to make one outside this package.
func RequireID ¶ added in v1.16.0
RequireID trims id and refuses anything that is not one URL path segment. BuildURL's path.Join resolves "..", and a server or proxy may decode "%2F", so either would retarget the request.
func RequireResponseID ¶ added in v1.16.0
RequireResponseID trims an ID from a server response and refuses it unless it is one URL path segment.
type Reach ¶ added in v1.20.0
type Reach struct {
// Raw is the first page's value as sent, nil when the key was absent or null.
Raw json.RawMessage
// Value is Raw as a string, or Raw's JSON text when the server sent something else.
Value string
// Changed says a later page stated another value, or none: each page is resolved on its
// own, so access that changes during a multi-page read leaves the pages disagreeing.
Changed bool
}
Reach is how far an audit list reaches for its reader, as the server stated it. It describes the rule that filtered the rows, not the rows: an empty page keeps its reach.
func FetchPagesUpToWithReach ¶ added in v1.20.0
func FetchPagesUpToWithReach[T any](ac *client.AlpaconClient, endpoint string, params map[string]string, limit int) ([]T, Reach, error)
FetchPagesUpToWithReach is FetchPagesUpTo for an audit list whose envelope states the reader's reach. The reach comes from the first page; Changed says a later page disagreed.
type ResolveByNameOptions ¶ added in v1.13.2
type ResolveByNameOptions struct {
Endpoint string
FilterKey string
Name string
BlankMsg string
NotFoundMsg string
}
ResolveByNameOptions names ResolveByName's parameters so a call site spells out each same-typed field, such as BlankMsg and NotFoundMsg, instead of passing them by position, where a swap would compile silently.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package acl talks to the command pre-approval ledger held by the signer.
|
Package acl talks to the command pre-approval ledger held by the signer. |