requests

package
v0.27.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Overview

Package requests defines structures to represent requests' bodies from API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptInvite

type AcceptInvite struct {
	TenantID string `param:"tenant" validate:"required"`
	UserID   string `header:"X-ID" validate:"required"`
}

type AuthLocalUser added in v0.18.0

type AuthLocalUser struct {
	// Identifier represents an username or email.
	//
	// TODO: change json tag from username to identifier and update the OpenAPI.
	Identifier models.UserAuthIdentifier `json:"username" validate:"required"`
	Password   string                    `json:"password" validate:"required"`
}

AuthLocalUser is the structure to represent the request body for the user auth endpoint.

type AuthTokenGet

type AuthTokenGet struct {
	UserParam
}

AuthTokenGet is the structure to represent the request data for get auth token endpoint.

type AuthTokenSwap

type AuthTokenSwap struct {
	TenantParam
}

AuthTokenSwap is the structure to represent the request data for swap auth token endpoint.

type CancelMembershipInvitation

type CancelMembershipInvitation struct {
	TenantID      string `param:"tenant" validate:"required"`
	UserID        string `header:"X-ID" validate:"required"`
	InvitedUserID string `param:"uid" validate:"required"`
}

type CreateAPIKey added in v0.15.0

type CreateAPIKey struct {
	UserID    string          `header:"X-ID"`
	TenantID  string          `header:"X-Tenant-ID"`
	Role      authorizer.Role `header:"X-Role"`
	Name      string          `json:"name" validate:"required,api-key_name"`
	ExpiresAt int             `json:"expires_at" validate:"required,api-key_expires-at"`
	Key       string          `json:"key" validate:"omitempty,uuid"`
	OptRole   authorizer.Role `json:"role" validate:"omitempty,member_role"`
}

type CreateInstallKey

type CreateInstallKey struct {
	UserID   string `header:"X-ID"`
	TenantID string `header:"X-Tenant-ID"`
	Name     string `json:"name" validate:"required,api-key_name"`
	// Mode is the enrollment policy. Omitted defaults to "automatic". Mode-specific fields
	// (WebhookURL/WebhookSecret, AllowedMACs) are validated in the service.
	Mode string `json:"mode" validate:"omitempty,oneof=automatic manual webhook allowlist"`
	// WebhookURL and WebhookSecret configure the webhook mode; AllowedMACs configures the allowlist mode.
	WebhookURL    string   `json:"webhook_url" validate:"omitempty,url"`
	WebhookSecret string   `json:"webhook_secret"`
	AllowedMACs   []string `json:"allowed_macs" validate:"omitempty,dive,required"`
	// WebhookTimeout (seconds, max 15) is the synchronous request timeout; WebhookCallbackTTL (seconds,
	// max 24h) is the deferred-decision token's validity. 0/omitted uses the server default.
	WebhookTimeout     int `json:"webhook_timeout" validate:"omitempty,min=0,max=15"`
	WebhookCallbackTTL int `json:"webhook_callback_ttl" validate:"omitempty,min=0,max=86400"`
	// ExpiresAt is the absolute date the key expires. A null (or omitted) value means the key never
	// expires. When set, it must be in the future.
	ExpiresAt *time.Time `json:"expires_at"`
	// UsageLimit caps how many devices may enroll: 1 is single-use (one-off), a higher value is that
	// many devices, 0 (or omitted) is unlimited. Whether the key is reusable is derived from this.
	UsageLimit int  `json:"usage_limit" validate:"omitempty,min=0"`
	Ephemeral  bool `json:"ephemeral"`
	// EphemeralTimeout is how many minutes an ephemeral device may stay offline before removal
	// (1-10). Only honored when Ephemeral is true; defaults to the maximum when omitted.
	EphemeralTimeout int      `json:"ephemeral_timeout" validate:"omitempty,min=1,max=10"`
	Tags             []string `json:"tags" validate:"omitempty,dive,required"`
}

type CreateTag added in v0.21.0

type CreateTag struct {
	TenantID string `param:"tenant" header:"X-Tenant-ID" validate:"required,uuid"`
	Name     string `json:"name" validate:"required,min=3,max=255,alphanum,ascii,excludes=/@&:"`
}

type CreateUserToken added in v0.16.0

type CreateUserToken struct {
	UserID   string `param:"id" header:"X-ID" validate:"required"`
	TenantID string `param:"tenant" validate:"omitempty,uuid"`
}

type DeleteAPIKey added in v0.16.0

type DeleteAPIKey struct {
	TenantID string `header:"X-Tenant-ID"`
	Name     string `param:"name" validate:"required"`
}

type DeleteTag added in v0.21.0

type DeleteTag struct {
	TenantID string `param:"tenant" header:"X-Tenant-ID" validate:"required,uuid"`
	Name     string `param:"name" validate:"required"`
}

type DeviceAuth

type DeviceAuth struct {
	Info       *DeviceInfo     `json:"info" validate:"required"`
	Sessions   []string        `json:"sessions,omitempty"`
	Hostname   string          `json:"hostname,omitempty" validate:"required_without=Identity,omitempty,device_name" hash:"-"`
	Identity   *DeviceIdentity `json:"identity,omitempty" validate:"required_without=Hostname,omitempty"`
	PublicKey  string          `json:"public_key" validate:"required"`
	TenantID   string          `json:"tenant_id" validate:"required"`
	InstallKey string          `json:"install_key,omitempty"`
	RealIP     string          `header:"X-Real-IP"`
	// ForwardedHost/ForwardedProto carry the public base (set by the gateway) so a webhook-mode
	// enrollment can build an absolute callback URL for the integrator.
	ForwardedHost  string `header:"X-Forwarded-Host"`
	ForwardedProto string `header:"X-Forwarded-Proto"`
}

DeviceAuth is the structure to represent the request data for device auth endpoint.

type DeviceCreateTag

type DeviceCreateTag struct {
	DeviceParam
	TagBody
}

DeviceCreateTag is the structure to represent the request data for device create tag endpoint.

type DeviceDelete

type DeviceDelete struct {
	DeviceParam
}

DeviceDelete is the structure to represent the request data for delete device endpoint.

type DeviceDeleteCustomField added in v0.25.0

type DeviceDeleteCustomField struct {
	TenantID string `header:"X-Tenant-ID"`
	DeviceParam
	Key string `param:"key" validate:"required,min=1,max=64"`
}

type DeviceGet

type DeviceGet struct {
	DeviceParam
}

DeviceGet is the structure to represent the request data for get device endpoint.

type DeviceIdentity

type DeviceIdentity struct {
	MAC string `json:"mac"`
}

type DeviceInfo

type DeviceInfo struct {
	ID         string `json:"id"`
	PrettyName string `json:"pretty_name"`
	Version    string `json:"version"`
	Arch       string `json:"arch"`
	Platform   string `json:"platform"`
}

type DeviceList added in v0.16.0

type DeviceList struct {
	TenantID     string              `header:"X-Tenant-ID"`
	DeviceStatus models.DeviceStatus `query:"status"` //  TODO: validate
	query.Paginator
	query.Sorter
	query.Filters
}

type DeviceLoginCodeResolve

type DeviceLoginCodeResolve struct {
	Code string `param:"code" validate:"required"`
}

DeviceLoginCodeResolve is the structure to represent the request data for the device login code resolve endpoint.

type DeviceLookup

type DeviceLookup struct {
	TenantID string `query:"tenant_id" validate:"required"`
	Name     string `query:"name" validate:"required"`
}

DeviceLookup is the structure to represent the request data for lookup device endpoint.

type DeviceOffline

type DeviceOffline struct {
	DeviceParam
}

DeviceOffline is the structure to represent the request data for offline device endpoint.

type DevicePairingAccept

type DevicePairingAccept struct {
	Code     string `param:"code" validate:"required"`
	TenantID string `json:"tenant_id" validate:"required,uuid"`
}

DevicePairingAccept is the structure to represent the request data for the device pairing accept endpoint. The code is validated (normalized + checked) in the service, not here, since its charset/length is the pairing-code alphabet, not hexadecimal.

type DevicePairingCreate

type DevicePairingCreate struct {
	Info      *DeviceInfo     `json:"info" validate:"required"`
	Hostname  string          `json:"hostname,omitempty" validate:"required_without=Identity,omitempty,device_name" hash:"-"`
	Identity  *DeviceIdentity `json:"identity,omitempty" validate:"required_without=Hostname,omitempty"`
	PublicKey string          `json:"public_key" validate:"required"`
	Code      string          `json:"code,omitempty"`
}

DevicePairingCreate is the structure to represent the request data for the device pairing creation endpoint. It mirrors DeviceAuth minus the tenant, which the user chooses at accept time.

Code is optional: when set, the agent was handed a pre-authorized pairing code at install time (see PrepareDevicePairing), so instead of minting a code for a user to accept, the server claims it and accepts the device automatically.

type DevicePairingStatus

type DevicePairingStatus struct {
	Code string `param:"code" validate:"required"`
}

DevicePairingStatus is the structure to represent the request data for the device pairing status endpoint.

type DeviceParam

type DeviceParam struct {
	UID string `param:"uid" validate:"required"`
}

DeviceParam is a structure to represent and validate a device UID as path param.

type DeviceRemoveTag

type DeviceRemoveTag struct {
	DeviceParam
	TagBody
}

DeviceRemoveTag is the structure to represent the request data for device remove tag endpoint.

type DeviceRename

type DeviceRename struct {
	DeviceParam
	Name string `json:"name" validate:"required"`
}

DeviceRename is the structure to represent the request data for rename device endpoint.

type DeviceSetCustomField added in v0.25.0

type DeviceSetCustomField struct {
	TenantID string `header:"X-Tenant-ID"`
	DeviceParam
	Key   string `param:"key" validate:"required,min=1,max=64"`
	Value string `json:"value" validate:"max=256"`
}

type DeviceUpdate

type DeviceUpdate struct {
	TenantID string `header:"X-Tenant-ID"`
	UID      string `param:"uid" validate:"required"`
	Name     string `json:"name" validate:"omitempty,device_name"`
}

type DeviceUpdateStatus

type DeviceUpdateStatus struct {
	TenantID string `header:"X-Tenant-ID"`
	UID      string `param:"uid" validate:"required"`
	Status   string `param:"status" validate:"required,oneof=accepted pending rejected"`
}

DeviceStatus is the structure to represent the request data for update device status to pending endpoint.

type DeviceUpdateTag

type DeviceUpdateTag struct {
	DeviceParam
	Tags []string `json:"tags" validate:"required,min=0,max=3,unique,dive,min=3,max=255,alphanum,ascii,excludes=/@&:"`
}

DeviceUpdateTag is the structure to represent the request data for device update tags endpoint.

type EnrollmentCallback

type EnrollmentCallback struct {
	Token    string `param:"token" validate:"required"`
	Decision string `json:"decision" validate:"required,oneof=accept reject"`
	Reason   string `json:"reason"`
}

EnrollmentCallback is a webhook integrator's deferred decision, redeemed against the signed callback token embedded in the URL. The token is the credential (no API key), so there is no tenant header.

type FingerprintParam

type FingerprintParam struct {
	Fingerprint string `param:"fingerprint" validate:"required"`
}

FingerprintParam is a structure to represent and validate a public key fingerprint as path param.

type GenerateInvitationLink struct {
	ForwardedHost  string          `header:"X-Forwarded-Host" validate:"required"`
	ForwardedProto string          `header:"X-Forwarded-Proto"`
	TenantID       string          `param:"tenant" validate:"required,uuid"`
	UserID         string          `header:"X-ID" validate:"required"`
	MemberEmail    string          `json:"email" validate:"required"`
	MemberRole     authorizer.Role `json:"role" validate:"required,member_role"`
}

type GetStats added in v0.21.0

type GetStats struct {
	TenantID string `header:"X-Tenant-ID"`
}

type GetSystemInfo added in v0.18.0

type GetSystemInfo struct {
	Host string `header:"X-Forwarded-Host"`
	Port int    `header:"X-Forwarded-Port"`
}

type LeaveNamespace added in v0.17.1

type LeaveNamespace struct {
	UserID string `header:"X-ID" validate:"required"`
	// TenantID represents the namespace that the user intends to leave.
	TenantID string `param:"tenant" validate:"required,uuid"`
	// AuthenticatedTenantID represents the namespace to which the user is currently authenticated.
	AuthenticatedTenantID string `header:"X-Tenant-ID" validate:"required"`
}

type ListAPIKey added in v0.16.0

type ListAPIKey struct {
	TenantID string `header:"X-Tenant-ID"`
	query.Paginator
	query.Sorter
}

type ListInstallKey

type ListInstallKey struct {
	TenantID string `header:"X-Tenant-ID"`
	query.Paginator
	query.Sorter
}

type ListInstallKeyEvents

type ListInstallKeyEvents struct {
	TenantID string `header:"X-Tenant-ID"`
	// ID is the install key's digest. History is keyed by digest, not name: names are unique only per
	// namespace and can be reused (the system "legacy" key) or renamed, so a name would be ambiguous.
	ID string `param:"id" validate:"required"`
	query.Paginator
	query.Sorter
}

type ListPublicKeys added in v0.21.0

type ListPublicKeys struct {
	TenantID string `header:"X-Tenant-ID"`
	query.Paginator
	query.Filters
}

type ListSessions added in v0.21.0

type ListSessions struct {
	TenantID string `header:"X-Tenant-ID"`
	query.Paginator
	query.Filters
}

type ListTags added in v0.21.0

type ListTags struct {
	TenantID string `param:"tenant" header:"X-Tenant-ID" validate:"required,uuid"`
	query.Paginator
	query.Filters
	query.Sorter
}

type MemberList

type MemberList struct {
	TenantID string `param:"tenant" validate:"required,uuid"`
	query.Paginator
}

MemberList is the structure to represent the request data for the list namespace members endpoint, consistent with the rest of the /namespaces/:tenant family.

type MemberParam

type MemberParam struct {
	MemberUID string `param:"uid" validate:"required"`
}

MemberParam is a structure to represent and validate a member UID as path param.

type NamespaceAddMember added in v0.16.0

type NamespaceAddMember struct {
	ForwardedHost  string          `header:"X-Forwarded-Host" validate:"required"`
	ForwardedProto string          `header:"X-Forwarded-Proto"`
	UserID         string          `header:"X-ID" validate:"required"`
	TenantID       string          `param:"tenant" validate:"required,uuid"`
	MemberEmail    string          `json:"email" validate:"required"`
	MemberRole     authorizer.Role `json:"role" validate:"required,member_role"`
}

type NamespaceCreate

type NamespaceCreate struct {
	UserID   string `header:"X-ID" validate:"required"`
	Name     string `json:"name"  validate:"required,hostname_rfc1123,excludes=."`
	TenantID string `json:"tenant" validate:"omitempty,uuid"`
	Type     string `json:"type" validate:"omitempty,lowercase,oneof=personal team"`
}

NamespaceCreate is the structure to represent the request data for create namespace endpoint.

type NamespaceDelete

type NamespaceDelete struct {
	TenantParam
}

NamespaceDelete is the structure to represent the request data for delete namespace endpoint.

type NamespaceEdit

type NamespaceEdit struct {
	TenantParam
	Name     string `json:"name" validate:"omitempty,hostname_rfc1123,excludes=."`
	Settings struct {
		SessionRecord          *bool   `json:"session_record" validate:"omitempty"`
		ConnectionAnnouncement *string `json:"connection_announcement" validate:"omitempty,min=0,max=4096"`
	} `json:"settings"`
}

NamespaceEdit is the structure to represent the request data for edit namespace endpoint.

type NamespaceGet

type NamespaceGet struct {
	TenantParam
}

NamespaceGet is the structure to represent the request data for get namespace endpoint.

type NamespaceList added in v0.17.0

type NamespaceList struct {
	UserID   string `header:"X-ID"`
	TenantID string `header:"X-Tenant-ID"`
	// IsAdmin is set by nginx from the /auth subrequest; client-supplied X-Admin is overwritten.
	IsAdmin bool `header:"X-Admin"`
	query.Paginator
	query.Filters
}

NamespaceList is the structure to represent the request data for list namespaces endpoint.

type NamespaceMembershipInvitationList

type NamespaceMembershipInvitationList struct {
	// ForwardedHost is only used to build the copyable invite_url; it's optional so a missing
	// header degrades to omitting the link rather than failing the whole listing.
	ForwardedHost  string `header:"X-Forwarded-Host"`
	ForwardedProto string `header:"X-Forwarded-Proto"`
	TenantID       string `param:"tenant" validate:"required"`
	UserID         string `header:"X-ID" validate:"required"`
	query.Paginator
	query.Sorter
	query.Filters
}

type NamespaceRemoveMember added in v0.16.0

type NamespaceRemoveMember struct {
	UserID   string `header:"X-ID" validate:"required"`
	TenantID string `param:"tenant" validate:"required,uuid"`
	MemberID string `param:"uid" validate:"required"`
}

type NamespaceUpdateMember added in v0.16.0

type NamespaceUpdateMember struct {
	UserID     string          `header:"X-ID" validate:"required"`
	TenantID   string          `param:"tenant" validate:"required,uuid"`
	MemberID   string          `param:"uid" validate:"required"`
	MemberRole authorizer.Role `json:"role" validate:"omitempty,member_role"`
}

type OptionalTime

type OptionalTime struct {
	Present bool
	Value   *time.Time
}

OptionalTime carries RFC 7396 (JSON Merge Patch) semantics for a nullable field in a partial update: an omitted key leaves the value unchanged (Present is false), an explicit null clears it (Present is true, Value is nil), and a timestamp sets it.

func (*OptionalTime) UnmarshalJSON

func (o *OptionalTime) UnmarshalJSON(data []byte) error

type PublicKeyAuth

type PublicKeyAuth struct {
	Fingerprint string `json:"fingerprint" validate:"required"`
	Data        string `json:"data" validate:"required"`
}

PublicKeyAuth is the structure to represent the request data for public key auth endpoint.

type PublicKeyCreate

type PublicKeyCreate struct {
	Data        []byte          `json:"data" validate:"required"`
	Filter      PublicKeyFilter `json:"filter" validate:"required"`
	Name        string          `json:"name" validate:"required"`
	Username    string          `json:"username" validate:"required,regexp"`
	TenantID    string          `json:"-"`
	Fingerprint string          `json:"-"`
}

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

type PublicKeyDelete

type PublicKeyDelete struct {
	FingerprintParam
}

PublicKeyDelete is the structure to represent the request data for delete public key endpoint.

type PublicKeyFilter

type PublicKeyFilter struct {
	Hostname string   `json:"hostname,omitempty" validate:"required_without=Tags,excluded_with=Tags,regexp"`
	Tags     []string `json:"tags,omitempty" validate:"required_without=Hostname"`
}

type PublicKeyGet

type PublicKeyGet struct {
	FingerprintParam
	TenantParam
}

PublicKeyGet is the structure to represent the request data for get public key endpoint.

type PublicKeyTagAdd

type PublicKeyTagAdd struct {
	FingerprintParam
	TagParam
}

PublicKeyTagAdd is the structure to represent the request data for add tag to public key endpoint.

type PublicKeyTagRemove

type PublicKeyTagRemove struct {
	FingerprintParam
	TagParam
}

PublicKeyTagRemove is the structure to represent the request data for remove tag from public key endpoint.

type PublicKeyTagsUpdate

type PublicKeyTagsUpdate struct {
	FingerprintParam
	Tags []string `json:"tags" validate:"required,min=1,max=3,unique,dive,min=3,max=255,alphanum,ascii,excludes=/@&:"`
}

PublicKeyTagsUpdate is the structure to represent the request data for update tags from public key endpoint.

type PublicKeyUpdate

type PublicKeyUpdate struct {
	FingerprintParam
	// Name is the public key's name.
	Name string `json:"name" validate:"required"`
	// Username is the public key's username.
	Username string `json:"username" validate:"required,regexp"`
	// Filter is the public key's filter.
	Filter PublicKeyFilter `json:"filter" validate:"required"`
}

PublicKeyUpdate is the structure to represent the request data for update public key endpoint.

type PullTag added in v0.21.0

type PullTag struct {
	TenantID string `param:"tenant" header:"X-Tenant-ID" validate:"required,uuid"`
	Name     string `param:"name" validate:"required,min=3,max=255,alphanum,ascii,excludes=/@&:"`
	// TargetID is the identifier of the target to pull the tag of.
	// For the reason cannot of it can be a list of things (UID for device, ID for firewall, etc...), it
	// cannot be parsed and must be set manually
	TargetID string `validate:"required"`
}

type PushTag added in v0.21.0

type PushTag struct {
	TenantID string `param:"tenant" header:"X-Tenant-ID" validate:"required,uuid"`
	Name     string `param:"name" validate:"required,min=3,max=255,alphanum,ascii,excludes=/@&:"`
	// TargetID is the identifier of the target to push the tag on.
	// For the reason cannot of it can be a list of things (UID for device, ID for firewall, etc...), it
	// cannot be parsed and must be set manually
	TargetID string `validate:"required"`
}

type RegisterUser

type RegisterUser struct {
	Name     string `json:"name" validate:"required,name"`
	Username string `json:"username" validate:"required,username"`
	// Email is required for open self-registration, but omitted on the invite flow:
	// there the email is derived from the invitation the Sig resolves to (the invitee
	// can't retarget it), so it's optional when a Sig is present.
	Email          string `json:"email" validate:"required_without=Sig,omitempty,email"`
	Password       string `json:"password" validate:"required,password"`
	EmailMarketing bool   `json:"email_marketing"`

	// Sig is the invitation code from the accept-invite link. When present, it proves
	// the email was already validated (the invitee clicked the link) and identifies the
	// invitation. It's a human-readable pairing code, not a UUID.
	Sig string `json:"sig" validate:"omitempty"`
}

type ResolveDevice added in v0.19.1

type ResolveDevice struct {
	TenantID string `header:"X-Tenant-ID" validate:"required"`
	UID      string `query:"uid" validate:"omitempty"`
	Hostname string `query:"hostname" validate:"omitempty"`
}

type ResolveInvitation

type ResolveInvitation struct {
	Invite string `query:"invite" validate:"required"`
}

ResolveInvitation resolves a pending invitation from its invite code alone — the only thing the accept-invite link carries. Public: the code is the credential.

type RevealInstallKey

type RevealInstallKey struct {
	TenantID string `header:"X-Tenant-ID"`
	Name     string `param:"name" validate:"required"`
}

type RoleBody

type RoleBody struct {
	Role string `json:"role" validate:"required,oneof=administrator operator observer"`
}

RoleBody is a structure to represent and validate a namespace role as request body.

type SessionAuthenticatedSet

type SessionAuthenticatedSet struct {
	SessionIDParam
	Authenticated bool `json:"authenticated" validate:"required"`
}

SessionAuthenticatedSet is the structure to represent the request data for set authenticated session endpoint.

type SessionCreate

type SessionCreate struct {
	UID       string `json:"uid" validate:"required"`
	DeviceUID string `json:"device_uid" validate:"required"`
	Username  string `json:"username" validate:"required"`
	IPAddress string `json:"ip_address" validate:"required"`
	Type      string `json:"type" validate:"required"`
	Term      string `json:"term" validate:""`
	Web       bool   `json:"web" validate:""`
}

SessionCreate is the structure to represent the request data for create session endpoint.

type SessionEditRecordStatus

type SessionEditRecordStatus struct {
	TenantParam
	SessionRecord bool `json:"session_record"`
}

SessionEditRecordStatus is the structure to represent the request data for edit session record status endpoint.

type SessionEvent added in v0.18.0

type SessionEvent struct {
	Type      string    `json:"type" validate:"required"`
	Timestamp time.Time `json:"timestamp" validate:"required"`
	Data      any       `json:"data" validate:"required"`
	Seat      int       `json:"seat" validate:"min=0"`
}

type SessionFinish

type SessionFinish struct {
	SessionIDParam
}

SessionFinish is the structure to represent the request data for finish session endpoint.

type SessionGet

type SessionGet struct {
	SessionIDParam
}

SessionGet is the structure to represent the request data for get session endpoint.

type SessionIDParam

type SessionIDParam struct {
	// UID is the session's UID.
	UID string `param:"uid" validate:"required"`
}

SessionIDParam is a structure to represent and validate a session UID as path param.

type SessionKeepAlive

type SessionKeepAlive struct {
	SessionIDParam
}

SessionFinish is the structure to represent the request data for keep alive session endpoint.

type SessionSeat added in v0.19.0

type SessionSeat struct {
	SessionIDParam
	ID int `json:"id"`
}

type SessionUpdate added in v0.16.0

type SessionUpdate struct {
	SessionIDParam
	Recorded      *bool   `json:"recorded"`
	Authenticated *bool   `json:"authenticated"`
	Type          *string `json:"type"`
}

type Setup

type Setup struct {
	Email     string `json:"email" validate:"required,email"`
	Name      string `json:"name" validate:"required,name"`
	Username  string `json:"username" validate:"required,username"`
	Password  string `json:"password" validate:"required,password"`
	Namespace string `json:"namespace" validate:"required,hostname_rfc1123,excludes=."`
}

type SystemInstallScript

type SystemInstallScript struct {
	Host                string `header:"X-Forwarded-Host"`
	Scheme              string `header:"X-Forwarded-Proto"`
	ForwardedPort       string `header:"X-Forwarded-Port"`
	TenantID            string `query:"tenant_id"`
	KeepAliveInternavel string `query:"keepalive_interval"`
	PreferredHostname   string `query:"preferred_hostname"`
	PreferredIdentity   string `query:"preferred_identity"`
}

type TagBody

type TagBody struct {
	Tag string `json:"tag" validate:"required,min=3,max=255,alphanum,ascii,excludes=/@&:"`
}

TagBody is a structure to represent and validate a tag as json request body.

type TagDelete

type TagDelete struct {
	TagParam
}

TagDelete is the structure to represent the request data for delete tag endpoint.

type TagParam

type TagParam struct {
	Tag string `param:"tag" validate:"required,min=3,max=255,alphanum,ascii,excludes=/@&:"`
}

TagParam is a structure to represent and validate a tag as path param.

type TagRename

type TagRename struct {
	TagParam
	NewTag string `json:"tag" validate:"required,min=3,max=255,alphanum,ascii,excludes=/@&:"`
}

TagRename is the structure to represent the request data for rename tag endpoint.

type TenantParam

type TenantParam struct {
	Tenant string `param:"tenant" validate:"required,uuid"`
}

TenantParam is a structure to represent and validate a namespace tenant as path param.

type UpdateAPIKey added in v0.16.0

type UpdateAPIKey struct {
	UserID   string `header:"X-ID"`
	TenantID string `header:"X-Tenant-ID"`
	// CurrentName is the current stored name. It is different from [UpdateAPIKey.Name], which is used
	// to handle the new target name (optional).
	CurrentName string          `param:"name" validate:"required"`
	Name        string          `json:"name" validate:"omitempty,api-key_name"`
	Role        authorizer.Role `json:"role" validate:"omitempty,member_role"`
}

type UpdateInstallKey

type UpdateInstallKey struct {
	UserID   string `header:"X-ID"`
	TenantID string `header:"X-Tenant-ID"`
	// CurrentName is the current stored name (path param). It differs from [UpdateInstallKey.Name],
	// which is the optional new target name.
	CurrentName string `param:"name" validate:"required"`
	Name        string `json:"name" validate:"omitempty,api-key_name"`
	// Mode changes the enrollment policy. Nil leaves it unchanged. Mode-specific fields are validated
	// in the service against the resulting key state.
	Mode *string `json:"mode" validate:"omitempty,oneof=automatic manual webhook allowlist"`
	// WebhookURL/WebhookSecret update the webhook config; nil leaves each unchanged. AllowedMACs
	// replaces the allowlist when non-nil.
	WebhookURL    *string  `json:"webhook_url" validate:"omitempty,url"`
	WebhookSecret *string  `json:"webhook_secret"`
	AllowedMACs   []string `json:"allowed_macs" validate:"omitempty,dive,required"`
	// WebhookTimeout/WebhookCallbackTTL update the webhook tuning; nil leaves each unchanged.
	WebhookTimeout     *int `json:"webhook_timeout" validate:"omitempty,min=0,max=15"`
	WebhookCallbackTTL *int `json:"webhook_callback_ttl" validate:"omitempty,min=0,max=86400"`
	// Revoked toggles revocation. Only a false->true transition is honored; un-revoking is rejected.
	Revoked *bool `json:"revoked"`
	// Disabled toggles the reversible pause. Both true and false are honored, so a disabled key can
	// be re-enabled (unlike Revoked).
	Disabled *bool `json:"disabled"`
	// ExpiresAt sets a new absolute expiration date (must be in the future). Omitted leaves the
	// current expiry unchanged; null makes the key never expire (RFC 7396 semantics).
	ExpiresAt OptionalTime `json:"expires_at"`
	// UsageLimit sets a new enrollment cap (0 unlimited, 1 single-use, N devices). Nil leaves it
	// untouched. Reusability is re-derived from it.
	UsageLimit *int     `json:"usage_limit" validate:"omitempty,min=0"`
	Tags       []string `json:"tags" validate:"omitempty,dive,required"`
	// Ephemeral toggles whether devices enrolled with the key are auto-removed after staying offline
	// past the timeout; nil leaves it unchanged. EphemeralTimeout (1-10 minutes) is only honored when
	// Ephemeral is true.
	Ephemeral        *bool `json:"ephemeral"`
	EphemeralTimeout *int  `json:"ephemeral_timeout" validate:"omitempty,min=1,max=10"`
}

type UpdateTag added in v0.21.0

type UpdateTag struct {
	TenantID string `param:"tenant" header:"X-Tenant-ID" validate:"required,uuid"`
	Name     string `param:"name" validate:"required"`
	// Similar to [UpdateTag.Name], but is used to update the tag's name instead of retrieve the tag.
	NewName string `json:"name" validate:"omitempty,min=3,max=255,alphanum,ascii,excludes=/@&:"`
}

type UpdateUser added in v0.16.0

type UpdateUser struct {
	UserID        string `header:"X-ID" validate:"required"`
	Name          string `json:"name" validate:"omitempty,name"`
	Username      string `json:"username" validate:"omitempty,username"`
	Email         string `json:"email" validate:"omitempty,email"`
	RecoveryEmail string `json:"recovery_email" validate:"omitempty,email"`
	// Password is the new password. If not empty, [UserDataUpdate.CurrentPassword] must be the current user's password.
	Password        string `json:"password" validate:"omitempty,password"`
	CurrentPassword string `json:"current_password"`
}

UpdateUser is the structure to represent the request body of the update user data endpoint.

type UserMembershipInvitationList

type UserMembershipInvitationList struct {
	UserID string `header:"X-ID"`
	query.Paginator
	query.Sorter
	query.Filters
}

type UserParam

type UserParam struct {
	ID string `param:"id" validate:"required"`
}

type UserPasswordUpdate

type UserPasswordUpdate struct {
	UserParam
	CurrentPassword string `json:"current_password" validate:"required,min=5,max=32,nefield=NewPassword"`
	NewPassword     string `json:"new_password" validate:"required,password,nefield=CurrentPassword"`
}

UserPasswordUpdate is the structure to represent the request body for the update user password endpoint.

Jump to

Keyboard shortcuts

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