Skip to main content

Admission

c.Admission calls the API's Admission group. Admit, reject and revoke the nodes that ask to join.

Methods​

MethodReturnsPermissionDescription
List(ctx, params)*Response[ListAdmissionResponse]admission:readList admission records.
Get(ctx, machineID)*Response[Admission]admission:readGet a machine's admission record.
Delete(ctx, machineID)erroradmission:writeDelete a machine.
Admit(ctx, input)erroradmission:writeAdmit a pending machine.
Reject(ctx, input)erroradmission:writeReject a pending machine.
Revoke(ctx, machineID)erroradmission:writeRevoke 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​

FieldTypeDescription
AdmittedAttime.TimeWhen the node was admitted.
DecidedAttime.TimeWhen the node was rejected or revoked.
EncryptionKeystringThe node's public X25519 encryption key, which the fingerprint covers.
FingerprintstringThe fingerprint of the node's two public keys: signing and encryption.
HostnamestringThe hostname the node gave.
JoinTokenstringOn an admitted record that a join made, the ID of the join token that admitted the node.
LastSeentime.TimeWhen the node last reported.
MachineIDstringThe machine ID of the node.
OnlineboolWhether the node is running now: it is in the registry.
PreviousAdmissionStateThe state of a node's admission record: pending, admitted, rejected or revoked.
PreviousFingerprintstringOn a pending record, the fingerprint of the earlier record; a different one is a new key.
ReasonstringWhy the node was rejected.
RequestedAttime.TimeWhen the node asked to join.
StateAdmissionStateThe state of a node's admission record: pending, admitted, rejected or revoked.

AdmissionAdmitInput​

FieldTypeDescription
MachineIDstringThe machine_id of the path. The machine ID of the node.
FingerprintstringThe fingerprint that osapi agent key fingerprint prints on the machine.

AdmissionRejectInput​

FieldTypeDescription
MachineIDstringThe machine_id of the path. The machine ID of the node.
ReasonstringWhy 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​

FieldTypeDescription
Items[]AdmissionThe admission records, in hostname order.
TotalItemsintThe number of records.

Example​

examples/sdk/client/admission.go runs each example of this page. With no argument, it lists them.