Issue a poller a bus token of its own and return the archive its site needs.
const url = 'https://example.com/api/v1/pollers/example/token';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"host":"example","pool":"example","port":1,"self_upgrade":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/pollers/example/token \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "host": "example", "pool": "example", "port": 1, "self_upgrade": true }'The response is the archive, not the token: this is the only moment the token exists in the
clear — only its digest is stored — and everything else the site needs is derivable here. See
poller_bundle.rs.
Creates the inventory row when the poller has not connected yet, which is what lets a site be prepared before anything is running there. That is also what makes the callout able to refuse an unregistered id: something has to be able to register one first.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Poller id
Request Bodyrequired
Section titled “Request Bodyrequired”What a new site needs, beyond its own name.
object
The hostname or IP address the site will dial. Must be one the bus certificate covers, or the site’s connection fails with nothing visible centrally. Defaults to the first name on the certificate that is not an internal one.
The pool this poller serves. Only used when the poller is not in the inventory yet — an existing poller keeps the pool it reported.
The bus port at that address. Defaults to 4222.
Whether this site should upgrade itself when the deployment does (ADR-051 Inc.4).
Defaults to true, which is why it is an Option rather than a plain bool: false
and “the caller said nothing” have to be told apart, and #[serde(default)] on a bool
gives both of them false. An older client that has never heard of this field therefore
gets the same archive a current one does with the box ticked.
It becomes a COMPOSE_PROFILES line in the generated .env, which is the only file at the
site that an upgrade does not replace — so the answer given here survives the site’s own
upgrades, and can be changed there without waiting for a new bundle.
Examplegenerated
{ "host": "example", "pool": "example", "port": 1, "self_upgrade": true}Responses
Section titled “Responses”A gzipped tar archive holding the site’s .env, the bus certificate, the composition and a README
The poller id is not usable as a bus identity, the pool name is not a valid subject token or is longer than 63 characters, or no address was given and none could be derived
The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI
document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies
undescribed — a client that has to guess the failure shape ends up parsing the success shape and
reading undefined.
object
object
Stable machine-readable code. Clients branch on this, never on the message.
Operator-facing sentence. Safe to display; never carries an internal error’s own text.
Examplegenerated
{ "error": { "code": "example", "message": "example" }}No valid bearer token
The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI
document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies
undescribed — a client that has to guess the failure shape ends up parsing the success shape and
reading undefined.
object
object
Stable machine-readable code. Clients branch on this, never on the message.
Operator-facing sentence. Safe to display; never carries an internal error’s own text.
Examplegenerated
{ "error": { "code": "example", "message": "example" }}Role lacks ManageSystem
The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI
document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies
undescribed — a client that has to guess the failure shape ends up parsing the success shape and
reading undefined.
object
object
Stable machine-readable code. Clients branch on this, never on the message.
Operator-facing sentence. Safe to display; never carries an internal error’s own text.
Examplegenerated
{ "error": { "code": "example", "message": "example" }}Skeleton mode, or this deployment has no bus certificate yet
The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI
document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies
undescribed — a client that has to guess the failure shape ends up parsing the success shape and
reading undefined.
object
object
Stable machine-readable code. Clients branch on this, never on the message.
Operator-facing sentence. Safe to display; never carries an internal error’s own text.
Examplegenerated
{ "error": { "code": "example", "message": "example" }}