request

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

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 AuthTokenGet

type AuthTokenGet struct {
	TenantParam
}

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 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,hostname_rfc1123" 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"`
}

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 DeviceGet

type DeviceGet struct {
	DeviceParam
}

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

type DeviceHeartbeat

type DeviceHeartbeat struct {
	DeviceParam
}

DeviceHeartbeat is the structure to represent the request data for device heartbeat 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 DeviceLookup

type DeviceLookup struct {
	Domain    string `query:"domain" validate:"required"`
	Name      string `query:"name" validate:"required"`
	Username  string `query:"username" validate:""`
	IPAddress string `query:"ip_address" validate:""`
}

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 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 DevicePendingStatus

type DevicePendingStatus struct {
	DeviceParam
	Status string `param:"status" validate:"required,oneof=accept reject pending unused"`
}

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

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 DeviceUpdateStatus

type DeviceUpdateStatus struct {
	DeviceParam
}

DeviceUpdateStatus is the structure to represent the request data for device update status 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 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 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 NamespaceAddUser

type NamespaceAddUser struct {
	TenantParam
	Username string `json:"username" validate:"required"`
	RoleBody
}

NamespaceAddUser is the structure to represent the request data for add member to namespace endpoint.

type NamespaceCreate

type NamespaceCreate struct {
	Name     string `json:"name"  validate:"required,hostname_rfc1123,excludes=."`
	TenantID string `json:"tenant" validate:"min=3,max=255,ascii,excludes=/@&:"`
}

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:"required,hostname_rfc1123,excludes=."`
}

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

type NamespaceEditUser

type NamespaceEditUser struct {
	TenantParam
	MemberParam
	RoleBody
}

NamespaceEditUser is the structure to represent the request data for edit member from namespace endpoint.

type NamespaceGet

type NamespaceGet struct {
	TenantParam
}

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

type NamespaceRemoveUser

type NamespaceRemoveUser struct {
	TenantParam
	MemberParam
}

NamespaceRemoveUser is the structure to represent the request data for remove member from namespace endpoint.

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"`
	// 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 */
}

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 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:""`
}

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 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 Setup added in v0.10.0

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

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,min=3,max=255,ascii,excludes=/@&:"`
}

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

type UserAuth

type UserAuth struct {
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required"`
}

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

type UserDataUpdate

type UserDataUpdate struct {
	UserParam
	Name     string `json:"name" validate:"required"`
	Username string `json:"username" validate:"required"`
	Email    string `json:"email" validate:"required"`
}

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

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=30,nefield=NewPassword"`
	NewPassword     string `json:"new_password" validate:"required,min=5,max=30,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