Skip to content

CreateEnrollmentToken

POST
/hopbox.admin.v1.ServerService/CreateEnrollmentToken
curl --request POST \
--url https://example.com/hopbox.admin.v1.ServerService/CreateEnrollmentToken \
--header 'Connect-Protocol-Version: 1' \
--header 'Connect-Timeout-Ms: 1000' \
--header 'Content-Type: application/json' \
--data '{ "pool": "example", "roles": [ "example" ], "serverId": "example", "peerAddress": "example", "ttl": "example" }'

CreateEnrollmentToken makes a token with which one new server enrolls into a pool. The token works once and expires after its ttl, 1 hour by default. The response holds the only copy of the token: the install keeps only a hash of its secret. A retry with the same idempotency key makes no second token. It fails with ALREADY_EXISTS, because the install has no copy of the secret.

Connect-Protocol-Version
Connect-Protocol-Version

Define the version of the Connect protocol

number
Allowed value: 1

Define the version of the Connect protocol

Example

1
Connect-Timeout-Ms
Connect-Timeout-Ms

Define the timeout, in ms

number

Define the timeout, in ms

Example

1000
Media typeapplication/json
CreateEnrollmentTokenRequest

CreateEnrollmentTokenRequest names the pool of the token.

object
pool
pool

Pool is the name of the pool that the new server joins. Leave it empty for the pool default.

string
roles
roles

Roles are the roles that the new server can enroll with: node, dns, edge, or more than one. Leave it empty for the role node alone.

Array<string>
serverId
server_id

Server_id names an enrolled server, a UUID. The token then adds the roles to that server alone, in its pool, and enrolls no new server. Leave it empty for a token of a new server.

string
peerAddress
peer_address

Peer_address is the peer address of the server that enrolls with the token: one public IPv4 address on its uplink, such as 203.0.113.5. The enrollment must come from it, and the new server keeps it. Leave it empty for a token without one.

string
ttl
ttl

Ttl is how long the token works, at most 24 hours. Leave it absent for 1 hour.

string format: duration

Example generated

{
"pool": "example",
"roles": [
"example"
],
"serverId": "example",
"peerAddress": "example",
"ttl": "example"
}

Success

Media typeapplication/json
CreateEnrollmentTokenResponse

CreateEnrollmentTokenResponse holds the new token.

object
token
token

Token is the enrollment token, hbxe_. It is a secret. Pass it to hopboxd enroll –token on the new server.

string
tokenId
token_id

Token_id is the ID of the token, as the audit log names it.

string
pool
pool

Pool is the name of the pool of the token.

string
expireTime
expire_time

Expire_time is the end of the token.

string format: date-time
caHash
ca_hash

Ca_hash is the SHA-256, in hex, of the certificate of the install CA. The token holds it too.

string
roles
roles

Roles are the roles that the new server can enroll with.

Array<string>
serverId
server_id

Server_id is the enrolled server that the token adds roles to, or empty.

string
peerAddress
peer_address

Peer_address is the address from which the enrollment must come, or empty.

string

Example

{
"expireTime": "2023-01-15T01:30:15.01Z"
}

Error

Media typeapplication/json
Connect Error
object
code

The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].

string
Allowed values: canceled unknown invalid_argument deadline_exceeded not_found already_exists permission_denied resource_exhausted failed_precondition aborted out_of_range unimplemented internal unavailable data_loss unauthenticated
message

A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.

string
details

A list of messages that carry the error details. There is no limit on the number of messages.

Array<object>

Contains an arbitrary serialized message along with a @type that describes the type of the serialized message, with an additional debug field for ConnectRPC error details.

object
type

A URL that acts as a globally unique identifier for the type of the serialized message. For example: type.googleapis.com/google.rpc.ErrorInfo.

string
value

The Protobuf message, serialized as bytes and base64-encoded. The specific message type is identified by the type field.

string format: byte
debug
Debug

Deserialized error detail payload. The ‘type’ field indicates the schema. This field is for easier debugging and should not be relied upon for application logic.

object
key
additional properties
any
key
additional properties
any
key
additional properties
any

Example

{
"code": "canceled"
}