Admission
c.Admission calls the API's Admission group. Admit, reject and revoke the
nodes that ask to join.
Methods
| Method | Returns | Permission | Description |
|---|---|---|---|
List(ctx, params) | *Response[ListAdmissionResponse] | admission:read | List admission records. |
Get(ctx, machineID) | *Response[Admission] | admission:read | Get a machine's admission record. |
Delete(ctx, machineID) | error | admission:write | Delete a machine. |
Admit(ctx, input) | error | admission:write | Admit a pending machine. |
Reject(ctx, input) | error | admission:write | Reject a pending machine. |
Revoke(ctx, machineID) | error | admission:write | Revoke an admitted machine. |
List
func (s *AdmissionService) List(
ctx context.Context,
params AdmissionListParams,
) (*Response[ListAdmissionResponse], error)
List admission records.
Returns each machine's admission record: pending, admitted, rejected or revoked, with whether it is online and when it was last seen.
It sends GET /api/admission, and needs the permission admission:read.
The examples of the method's definition:
List admission records, go run admission.go list:
resp, err := c.Admission.List(ctx, client.AdmissionListParams{})
List admission records, with --state pending, go run admission.go list-2:
resp, err := c.Admission.List(ctx, client.AdmissionListParams{State: types.AdmissionState("pending")})
Get
func (s *AdmissionService) Get(
ctx context.Context,
machineID string,
) (*Response[Admission], error)
Get a machine's admission record.
Returns one machine's admission record by machine ID.
It sends GET /api/admission/{machine_id}, and needs the permission
admission:read.
The examples of the method's definition:
Get a machine's admission record, go run admission.go get:
resp, err := c.Admission.Get(ctx, "d530664edc1c431eb5ef1e9dfd6617a5")
Delete
func (s *AdmissionService) Delete(
ctx context.Context,
machineID string,
) error
Delete a machine.
Removes a machine's key and each record of it, and keeps none. A machine that asks again is new. Use it for a machine that goes away on purpose, such as a VM that is rebuilt; revoke a machine that is not trusted.
It sends DELETE /api/admission/{machine_id}, and needs the permission
admission:write.
The examples of the method's definition:
Delete a machine, go run admission.go delete:
err := c.Admission.Delete(ctx, "d530664edc1c431eb5ef1e9dfd6617a5")
Admit
func (s *AdmissionService) Admit(
ctx context.Context,
input AdmissionAdmitInput,
) error
Admit a pending machine.
Admits a pending machine. The fingerprint must be the one that
osapi agent key fingerprint prints on the machine: it proves that the request
came from the machine the operator is looking at.
It sends POST /api/admission/{machine_id}/admit, and needs the permission
admission:write.
The examples of the method's definition:
Admit a pending machine, go run admission.go admit:
err := c.Admission.Admit(ctx, client.AdmissionAdmitInput{
Fingerprint: "SHA256:1f53dea6...",
MachineID: "d530664edc1c431eb5ef1e9dfd6617a5",
})
Reject
func (s *AdmissionService) Reject(
ctx context.Context,
input AdmissionRejectInput,
) error
Reject a pending machine.
Rejects a pending machine, and keeps a record of the decision, so a machine that asks again is flagged.
It sends POST /api/admission/{machine_id}/reject, and needs the permission
admission:write.
The examples of the method's definition:
Reject a pending machine, go run admission.go reject:
err := c.Admission.Reject(ctx, client.AdmissionRejectInput{
MachineID: "d530664edc1c431eb5ef1e9dfd6617a5",
Reason: "unknown host",
})
Revoke
func (s *AdmissionService) Revoke(
ctx context.Context,
machineID string,
) error
Revoke an admitted machine.
Removes an admitted machine's key, and keeps a record of the decision. Nothing the machine signs verifies afterwards; to return, it asks again.
It sends POST /api/admission/{machine_id}/revoke, and needs the permission
admission:write.
The examples of the method's definition:
Revoke an admitted machine, go run admission.go revoke:
err := c.Admission.Revoke(ctx, "d530664edc1c431eb5ef1e9dfd6617a5")
Types
The fields of each type are the properties of its schema in the API's spec.
Admission
| Field | Type | Description |
|---|---|---|
AdmittedAt | time.Time | When the node was admitted. |
DecidedAt | time.Time | When the node was rejected or revoked. |
EncryptionKey | string | The node's public X25519 encryption key, which the fingerprint covers. |
Fingerprint | string | The fingerprint of the node's two public keys: signing and encryption. |
Hostname | string | The hostname the node gave. |
JoinToken | string | On an admitted record that a join made, the ID of the join token that admitted the node. |
LastSeen | time.Time | When the node last reported. |
MachineID | string | The machine ID of the node. |
Online | bool | Whether the node is running now: it is in the registry. |
Previous | AdmissionState | The state of a node's admission record: pending, admitted, rejected or revoked. |
PreviousFingerprint | string | On a pending record, the fingerprint of the earlier record; a different one is a new key. |
Reason | string | Why the node was rejected. |
RequestedAt | time.Time | When the node asked to join. |
State | AdmissionState | The state of a node's admission record: pending, admitted, rejected or revoked. |
AdmissionAdmitInput
| Field | Type | Description |
|---|---|---|
MachineID | string | The machine_id of the path. The machine ID of the node. |
Fingerprint | string | The fingerprint that osapi agent key fingerprint prints on the machine. |
AdmissionRejectInput
| Field | Type | Description |
|---|---|---|
MachineID | string | The machine_id of the path. The machine ID of the node. |
Reason | string | Why the machine is rejected; the machine and the record keep it. |
AdmissionState
The state of a node's admission record: pending, admitted, rejected or revoked.
A string, one of pending, admitted, rejected, revoked.
ListAdmissionResponse
| Field | Type | Description |
|---|---|---|
Items | []Admission | The admission records, in hostname order. |
TotalItems | int | The number of records. |
Example
examples/sdk/client/admission.go
runs each example of this page. With no argument, it lists them.