Interface

What other programs can rely on from lnk bucket.

lnk bucket

What scripts read of the backends and the files in them, each as JSON.

lnk bucket backend list --json

[{"name", "kind", "backend", "region", "buckets": {"personal" | "<agent id>": {"bucket", "encrypted", "remote", "files", "bytes", "agent"?: {"id", "name"}}}}], one entry per connected backend; a folder without a bucket there is left out. Read by scripts only.

lnk bucket tree [<path>] --json

{"personal": [...], "<agent id>": [...]}, one key per folder, each agent's by its ID, and only the folder holding <path> when given. Read by scripts only.

Each row

{"path", "size", "here", "backends": [["<backend>", "<mark>"], ...]}, here one of here, changed, new, offloaded, a mark one of checked, archived, unchecked, differs, missing.

An agent's buckets

The hidden commands lnk agent runs to carry an agent's buckets when it moves, leaves or is restored.

lnk bucket export <id>

{"password", "buckets": {"<backend>": "<bucket>"}}: agent <id>'s buckets here and their password, obscured as rclone keeps it; null without any. Read by lnk agent state-send.

lnk bucket adopt <id>

Reads {"password" | "plain", "buckets", "keys"?: {"<backend>": {"bucket", "key"}}}; puts the agent's buckets in place here: its encryption on buckets this machine knew, buckets in backends of the same name, and a backend <backend>-<id> for it alone from each key. Nonzero when none is reachable (a wrong password). Read by lnk agent receive, and lnk agent restore from before bucket restore.

lnk bucket delete --agent-id <id>

The agent left: its encryption and backends only for it go, and its buckets stay known. Read by lnk agent left.

lnk bucket keys <id> and revoke <id>

{"<backend>": {"bucket", "key"}}: through lnk cloud, a key reaching only each of the agent's buckets (found by its lnk-agent label), any before replaced; or those keys gone. Read by lnk agent move, to a box and back home.

lnk bucket restore --agent <name> [--agent-id <id>] --folder <folder>

Finds agent <name>'s buckets in your lnk cloud accounts by their labels (and yours, lnk-owner), asks their encryption password (a hidden question on stderr, which needs a terminal), puts them in place here as adopt does, with a key reaching only them where a backend makes one, and pulls the agent's files into <folder>. Refuses a name agents of two IDs have, without --id. Read by lnk agent restore, the one bucket command it runs.

What it prints

{"id", "buckets": {"<backend>": "<bucket>"}, "labels": {"<backend>": {"<name>": "<value>"}}} on stdout, labels each bucket's but those saying whose it is, and all else on stderr.

lnk bucket label <id> <name>=<value>...

{"<backend>": "<bucket>"}: through lnk cloud, the labels added to each of agent <id>'s buckets (found by its lnk-agent label, never one labelled as another login's), a bucket it couldn't label said on stderr and left out. Read by lnk agent backup (lnk-layout=2: its backups carry its own folder, Agent.tar, beside its harness's state).

What it refuses

A label not of Link's (lnk-), one that says whose a bucket is (lnk-agent, lnk-agent-name, lnk-owner), and names or values beyond 63 lowercase letters, digits, - and _.

lnk bucket find [--agent] [--agent-id]

[{"backend", "bucket", "place", "id", "name"}]: agents' buckets in your lnk cloud accounts, by their labels (and yours, lnk-owner). Read by lnk agent restore from before bucket restore.