responses

package
v0.27.0-rc.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateAPIKey added in v0.16.0

type CreateAPIKey struct {
	ID        string          `json:"id"`
	Name      string          `json:"name"`
	UserID    string          `json:"user_id"`
	TenantID  string          `json:"tenant_id"`
	Role      authorizer.Role `json:"role" validate:"required,oneof=administrator operator observer"`
	CreatedAt time.Time       `json:"created_at"`
	UpdatedAt time.Time       `json:"updated_at"`
	ExpiresIn int64           `json:"expires_in"`
}

CreateAPIKey is what the create-API-key route returns. ID is the key itself and this is the only time it is ever sent: nothing can read it back afterwards.

func CreateAPIKeyFromModel added in v0.16.0

func CreateAPIKeyFromModel(m *models.APIKey) *CreateAPIKey

CreateAPIKeyFromModel projects the stored key onto the response, which is where the model's internal fields are dropped rather than serialized by accident.

type CreateInstallKey

type CreateInstallKey struct {
	models.InstallKey

	// Key is the plaintext install key. Pass it to the installer as INSTALL_KEY.
	Key string `json:"key"`
}

CreateInstallKey is the response to minting an install key: the stored key exactly as the listing returns it, plus the plaintext, which is shown here and afterwards only through reveal.

func CreateInstallKeyFromModel

func CreateInstallKeyFromModel(m *models.InstallKey, plaintext string) *CreateInstallKey

CreateInstallKeyFromModel projects a stored install key into its creation response. The plaintext is a separate argument because the model carries only its digest: passing it explicitly is what stops the digest being returned to the caller by omission.

type CreateInstanceAPIKey

type CreateInstanceAPIKey struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	CreatedBy string    `json:"created_by"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	ExpiresAt time.Time `json:"expires_at"`
}

CreateInstanceAPIKey is the response to minting an instance API key. ID carries the plaintext key, which is returned here and nowhere else; the server keeps only its digest.

func CreateInstanceAPIKeyFromModel

func CreateInstanceAPIKeyFromModel(m *models.InstanceAPIKey, plaintext string) *CreateInstanceAPIKey

CreateInstanceAPIKeyFromModel projects a stored instance API key into its creation response. The plaintext key is a separate argument because the model carries only its digest: passing it explicitly is what stops the digest being returned to the caller by omission.

type Error

type Error struct {
	// Message is a human-readable description of what failed. It is always present.
	Message string `json:"message"`
	// Fields maps a request field name to the reason it was rejected. It is present only when the
	// error carries per-field detail.
	Fields map[string]string `json:"fields,omitempty"`
}

Error is the body of every API error response.

It is a projection, not a marshalling of the internal error type: that type carries a layer name and an internal code which must never reach a client.

type PublicKeyCreate

type PublicKeyCreate struct {
	Data        []byte          `json:"data"`
	Filter      PublicKeyFilter `json:"filter"`
	Name        string          `json:"name"`
	Username    string          `json:"username"`
	TenantID    string          `json:"tenant_id"`
	Fingerprint string          `json:"fingerprint"`
}

PublicKeyCreate is the structure to represent the request data for create public key endpoint.

type PublicKeyFilter

type PublicKeyFilter struct {
	Hostname string `json:"hostname,omitempty" validate:"required_without=Tags,excluded_with=Tags,regexp"`
	// FIXME: add validation for tags when it has at least one item.
	//
	// If used `min=1` to do that validation, when tags is empty, its zero value, and only hostname is provided,
	// it throws a error even with `required_without` and `excluded_with`.
	Tags []string `` /* 142-byte string literal not displayed */
}

PublicKeyFilter is the device selector as it is sent back to a client: either a hostname pattern or a tag set, never both.

type RevealInstallKey

type RevealInstallKey struct {
	Key string `json:"key"`
}

RevealInstallKey carries a install key's plaintext, decrypted on demand from its at-rest ciphertext.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL