adminclient

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package adminclient is the /_admin/... side of backd's HTTP API, as an add-on to the Go client: adminclient.New takes a configured *client.Client and reuses its address, realm, credentials, transport, retries and error mapping through client.Do. It is internal on purpose: a shipped program must not be able to administer a realm, so the public client leaves administration out and only backd's own tools (the CLI) build on this. If the admin API is ever made public this package moves to pkg/admin with the same shape.

Methods are named for what they do and take the pieces of the request (ids, a query, a body); answers are decoded into out (a pointer, or nil). Every method takes request options last (client.WithHeader for the proof of identity of a sensitive action, client.WithIfMatch, …).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeys

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

APIKeys are the realm's API keys (_admin/apikeys).

func (*APIKeys) Create

func (x *APIKeys) Create(ctx context.Context, body, out any, opts ...Opt) error

func (*APIKeys) Delete

func (x *APIKeys) Delete(ctx context.Context, name string, opts ...Opt) error

func (*APIKeys) List

func (x *APIKeys) List(ctx context.Context, out any, opts ...Opt) error

type Admin

type Admin struct {
	AppConfig  *AppConfig
	APIKeys    *APIKeys
	Audit      *Audit
	Compliance *Compliance
	Consents   *Consents
	DataChecks *DataChecks
	Data       *Data
	Encryption *Encryption
	Export     *Export
	Files      *Files
	Functions  *Functions
	Import     *Import
	Jobs       *Jobs
	MFA        *MFA
	Orgs       *Orgs
	Passwords  *Passwords
	Push       *Push
	Secrets    *Secrets
	Sessions   *Sessions
	Storage    *Storage
	Triggers   *Triggers
	Types      *Types
	Users      *Users
	// contains filtered or unexported fields
}

Admin calls the admin API through a client. Its fields group the endpoints by what they manage.

func New

func New(c *client.Client) *Admin

New returns the admin API of a configured client. It opens no connection of its own.

func (*Admin) Client

func (a *Admin) Client() *client.Client

Client returns the client the admin API is called through.

type AppConfig

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

AppConfig is the realm's app configuration (_admin/app-config).

func (*AppConfig) Get

func (x *AppConfig) Get(ctx context.Context, out any, opts ...Opt) (http.Header, error)

Get reads the configuration; the headers carry its ETag.

func (*AppConfig) History

func (x *AppConfig) History(ctx context.Context, q url.Values, out any, opts ...Opt) error

History lists the past versions.

func (*AppConfig) Patch

func (x *AppConfig) Patch(ctx context.Context, version string, body, out any, opts ...Opt) error

Patch changes it, conditional on the version read.

func (*AppConfig) Rollback

func (x *AppConfig) Rollback(ctx context.Context, version string, body, out any, opts ...Opt) error

Rollback goes back to a past version, conditional on the current one.

type Audit

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

Audit is the audit trail (_admin/audit).

func (*Audit) List

func (x *Audit) List(ctx context.Context, q url.Values, out any, opts ...Opt) error

type Compliance

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

Compliance is the realm's compliance scope (_admin/compliance).

func (*Compliance) Scope

func (x *Compliance) Scope(ctx context.Context, out any, opts ...Opt) error

type Consents

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

Consents are the consents of the realm's users (_admin/consents).

func (*Consents) Notify

func (x *Consents) Notify(ctx context.Context, body, out any, opts ...Opt) error

Notify asks the users to accept a consent again.

type Data

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

Data acts on documents regardless of their rules (_admin/data).

func (*Data) AssignOrg

func (x *Data) AssignOrg(ctx context.Context, database, collection string, q url.Values, body, out any, opts ...Opt) error

AssignOrg gives the documents of a collection that have no organization one.

func (*Data) Transfer

func (x *Data) Transfer(ctx context.Context, database, collection, id string, body, out any, opts ...Opt) error

Transfer moves a document to another organization (and team).

type DataChecks

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

DataChecks check the documents against their schemas (_admin/data-checks).

func (*DataChecks) Get

func (x *DataChecks) Get(ctx context.Context, database, name string, out any, opts ...Opt) error

Get reads the result of a check: of a database's collection, or the check with a name.

func (*DataChecks) List

func (x *DataChecks) List(ctx context.Context, out any, opts ...Opt) error

func (*DataChecks) Start

func (x *DataChecks) Start(ctx context.Context, body, out any, opts ...Opt) error

type Encryption

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

Encryption is field encryption (_admin/encryption).

func (*Encryption) Migrate

func (x *Encryption) Migrate(ctx context.Context, body, out any, opts ...Opt) error

func (*Encryption) Rekey

func (x *Encryption) Rekey(ctx context.Context, body, out any, opts ...Opt) error

func (*Encryption) Status

func (x *Encryption) Status(ctx context.Context, q url.Values, out any, opts ...Opt) error

type Export

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

Export is the realm export (_admin/export): a plan, its parts, and the lease that keeps one export running at a time.

func (*Export) Complete

func (x *Export) Complete(ctx context.Context, q url.Values, out any, opts ...Opt) error

Complete ends the export and releases its lease.

func (*Export) Part

func (x *Export) Part(ctx context.Context, q url.Values, opts ...Opt) (*Stream, error)

Part opens a part of the export: the caller reads and closes the body.

func (*Export) Plan

func (x *Export) Plan(ctx context.Context, q url.Values, body, out any, opts ...Opt) error

Plan asks for the plan of an export (GET), or starts one with a body (POST).

type Files

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

Files regenerate and manage file versions (_admin/files).

func (*Files) RegenerateVersions

func (x *Files) RegenerateVersions(ctx context.Context, body, out any, opts ...Opt) error

type Functions

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

Functions invokes and controls functions (_admin/functions, _admin/schedules, _admin/invocations).

func (*Functions) Control

func (x *Functions) Control(ctx context.Context, database, name, op string, out any, opts ...Opt) error

Control sends an operation to a function's schedule: "pause", "resume", "skip", …

func (*Functions) Invocations

func (x *Functions) Invocations(ctx context.Context, q url.Values, out any, opts ...Opt) error

func (*Functions) Invoke

func (x *Functions) Invoke(ctx context.Context, database, name string, body, out any, opts ...Opt) (http.Header, error)

Invoke runs a function through the admin route (the way to run an internal one), and returns the response headers.

func (*Functions) Schedules

func (x *Functions) Schedules(ctx context.Context, out any, opts ...Opt) error

type Import

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

Import loads an export into the realm (_admin/import).

func (*Import) Abort

func (x *Import) Abort(ctx context.Context, q url.Values, opts ...Opt) error

Abort cancels the import and releases its lease.

func (*Import) Begin

func (x *Import) Begin(ctx context.Context, body, out any, opts ...Opt) error

func (*Import) Send

func (x *Import) Send(ctx context.Context, method string, q url.Values, body io.Reader, contentType string, out any, opts ...Opt) error

Send sends a chunk of documents (POST, application/x-ndjson) or a file (PUT, application/octet-stream).

type Jobs

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

Jobs are the background jobs (_admin/jobs).

func (*Jobs) Control

func (x *Jobs) Control(ctx context.Context, id, op string, out any, opts ...Opt) error

Control sends an operation to a job: "cancel", "rerun", …

func (*Jobs) Get

func (x *Jobs) Get(ctx context.Context, id string, out any, opts ...Opt) error

func (*Jobs) List

func (x *Jobs) List(ctx context.Context, q url.Values, out any, opts ...Opt) error

type MFA

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

MFA is the realm's second-factor policy (_admin/mfa).

func (*MFA) Status

func (x *MFA) Status(ctx context.Context, out any, opts ...Opt) error

type Opt

type Opt = client.RequestOption

Opt is a request option: a header, an If-Match, …

type Opts

type Opts = []client.RequestOption

Opts is a list of request options.

func Proof

func Proof(headers map[string]string) Opts

Proof makes the request options that carry the fresh proof of identity a sensitive action asks for.

type Orgs

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

Orgs are the realm's organizations (_admin/orgs).

func (*Orgs) AddMember

func (x *Orgs) AddMember(ctx context.Context, id string, body any, opts ...Opt) error

func (*Orgs) Create

func (x *Orgs) Create(ctx context.Context, body, out any, opts ...Opt) error

func (*Orgs) Delete

func (x *Orgs) Delete(ctx context.Context, id string, opts ...Opt) error

func (*Orgs) Get

func (x *Orgs) Get(ctx context.Context, id string, out any, opts ...Opt) error

func (*Orgs) Invitations

func (x *Orgs) Invitations(ctx context.Context, id string, out any, opts ...Opt) error

func (*Orgs) Invite

func (x *Orgs) Invite(ctx context.Context, id string, body, out any, opts ...Opt) error

func (*Orgs) List

func (x *Orgs) List(ctx context.Context, q url.Values, out any, opts ...Opt) error

func (*Orgs) Members

func (x *Orgs) Members(ctx context.Context, id string, q url.Values, out any, opts ...Opt) error

func (*Orgs) Owned

func (x *Orgs) Owned(ctx context.Context, id string, out any, opts ...Opt) error

Owned reports what an organization owns.

func (*Orgs) Patch

func (x *Orgs) Patch(ctx context.Context, id string, body, out any, opts ...Opt) error

func (*Orgs) Reactivate

func (x *Orgs) Reactivate(ctx context.Context, id string, body any, opts ...Opt) error

func (*Orgs) RevokeInvitation

func (x *Orgs) RevokeInvitation(ctx context.Context, id, invitation string, opts ...Opt) error

func (*Orgs) SSODelete

func (x *Orgs) SSODelete(ctx context.Context, id, provider string, opts ...Opt) error

func (*Orgs) SSOList

func (x *Orgs) SSOList(ctx context.Context, id string, out any, opts ...Opt) error

SSOList lists an organization's sign-in connections.

func (*Orgs) SSOSet

func (x *Orgs) SSOSet(ctx context.Context, id, provider string, body, out any, opts ...Opt) error

func (*Orgs) SetClaims

func (x *Orgs) SetClaims(ctx context.Context, id string, claims any, opts ...Opt) error

func (*Orgs) SetOwner

func (x *Orgs) SetOwner(ctx context.Context, id string, body any, opts ...Opt) error

func (*Orgs) SetSlug

func (x *Orgs) SetSlug(ctx context.Context, id string, body, out any, opts ...Opt) error

type Passwords

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

Passwords expire and notify (_admin/passwords).

func (*Passwords) Expire

func (x *Passwords) Expire(ctx context.Context, body, out any, opts ...Opt) error

func (*Passwords) Notify

func (x *Passwords) Notify(ctx context.Context, out any, opts ...Opt) error

type Push

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

Push is the push notification side (_admin/push).

func (*Push) DeleteDevices

func (x *Push) DeleteDevices(ctx context.Context, q url.Values, out any, opts ...Opt) error

DeleteDevices removes devices of a platform ("web", after the keys were rotated).

func (*Push) Send

func (x *Push) Send(ctx context.Context, id string, out any, opts ...Opt) error

func (*Push) Sends

func (x *Push) Sends(ctx context.Context, q url.Values, out any, opts ...Opt) error

func (*Push) Test

func (x *Push) Test(ctx context.Context, body, out any, opts ...Opt) error

type Secrets

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

Secrets are the realm's secrets (_admin/secrets).

func (*Secrets) Create

func (x *Secrets) Create(ctx context.Context, body, out any, opts ...Opt) error

Create makes a generated secret key.

func (*Secrets) Delete

func (x *Secrets) Delete(ctx context.Context, name string, q url.Values, opts ...Opt) error

func (*Secrets) List

func (x *Secrets) List(ctx context.Context, out any, opts ...Opt) error

func (*Secrets) Put

func (x *Secrets) Put(ctx context.Context, name string, body any, opts ...Opt) error

Put sets a secret's value.

func (*Secrets) Rotate

func (x *Secrets) Rotate(ctx context.Context, name string, body, out any, opts ...Opt) error

type Sessions

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

Sessions ends the realm's sessions (_admin/sessions).

func (*Sessions) RevokeAll

func (x *Sessions) RevokeAll(ctx context.Context, out any, opts ...Opt) error

RevokeAll ends every session of the realm.

type Storage

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

Storage is file storage (_admin/storage).

func (*Storage) Check

func (x *Storage) Check(ctx context.Context, q url.Values, out any, opts ...Opt) error

func (*Storage) Reconcile

func (x *Storage) Reconcile(ctx context.Context, body, out any, opts ...Opt) error

func (*Storage) Usage

func (x *Storage) Usage(ctx context.Context, out any, opts ...Opt) error

type Stream

type Stream = client.Response

Stream is an answer read as it arrives. The caller closes Body.

type Triggers

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

Triggers are the function triggers (_admin/triggers).

func (*Triggers) Gaps

func (x *Triggers) Gaps(ctx context.Context, q url.Values, out any, opts ...Opt) error

func (*Triggers) ResolveGap

func (x *Triggers) ResolveGap(ctx context.Context, id string, out any, opts ...Opt) error

func (*Triggers) Status

func (x *Triggers) Status(ctx context.Context, out any, opts ...Opt) error

type Types

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

Types are the generated types of the realm (_admin/types).

func (*Types) Get

func (x *Types) Get(ctx context.Context, q url.Values, out any, opts ...Opt) error

type Users

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

Users are the realm's users (_admin/users).

func (*Users) AcceptConsents

func (x *Users) AcceptConsents(ctx context.Context, id string, body, out any, opts ...Opt) error

AcceptConsents records consents on behalf of a user.

func (*Users) ChangeEmail

func (x *Users) ChangeEmail(ctx context.Context, id string, body, out any, opts ...Opt) error

func (*Users) Create

func (x *Users) Create(ctx context.Context, body, out any, opts ...Opt) error

func (*Users) DeleteDevice

func (x *Users) DeleteDevice(ctx context.Context, id, device string, opts ...Opt) error

func (*Users) Devices

func (x *Users) Devices(ctx context.Context, id string, out any, opts ...Opt) error

func (*Users) Erase

func (x *Users) Erase(ctx context.Context, id string, out any, opts ...Opt) error

Erase erases a user and their data; the answer is the job doing it.

func (*Users) ExpirePassword

func (x *Users) ExpirePassword(ctx context.Context, id string, body, out any, opts ...Opt) error

func (*Users) Export

func (x *Users) Export(ctx context.Context, id, export string, out any, opts ...Opt) error

Export reads one of a user's exports.

func (*Users) Identities

func (x *Users) Identities(ctx context.Context, id string, out any, opts ...Opt) error

func (*Users) List

func (x *Users) List(ctx context.Context, q url.Values, out any, opts ...Opt) error

List lists users (filter with q: email, limit, after, …).

func (*Users) MFA

func (x *Users) MFA(ctx context.Context, id string, out any, opts ...Opt) error

func (*Users) OpenExport

func (x *Users) OpenExport(ctx context.Context, id, export string, opts ...Opt) (*Stream, error)

OpenExport opens the package of a ready export: the caller reads and closes the body.

func (*Users) Owned

func (x *Users) Owned(ctx context.Context, id string, out any, opts ...Opt) error

Owned reports what a user owns.

func (*Users) Patch

func (x *Users) Patch(ctx context.Context, id string, body, out any, opts ...Opt) error

Patch changes a user (disabling, roles, …).

func (x *Users) ResetLink(ctx context.Context, id string, body, out any, opts ...Opt) error

func (*Users) ResetMFA

func (x *Users) ResetMFA(ctx context.Context, id string, opts ...Opt) error

func (*Users) Role

func (x *Users) Role(ctx context.Context, id, role string, grant bool, out any, opts ...Opt) error

Role gives a role to a user, or takes it away.

func (*Users) SetNetworks

func (x *Users) SetNetworks(ctx context.Context, id string, body, out any, opts ...Opt) error

SetNetworks sets the networks a user may sign in or administer from.

func (*Users) SetPassword

func (x *Users) SetPassword(ctx context.Context, id string, body, out any, opts ...Opt) error

func (*Users) StartExport

func (x *Users) StartExport(ctx context.Context, id string, body, out any, opts ...Opt) error

StartExport starts a copy of a user's data.

func (*Users) UnlinkIdentity

func (x *Users) UnlinkIdentity(ctx context.Context, id, provider string, opts ...Opt) error

Jump to

Keyboard shortcuts

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