models

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 2 Imported by: 17

Documentation

Index

Constants

View Source
const (
	MqttClientConnectedEventType    = "client_connected"
	MqttClientDisconnectedEventType = "client_disconnected"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveSession

type ActiveSession struct {
	UID      UID       `json:"uid"`
	LastSeen time.Time `json:"last_seen" bson:"last_seen"`
}

type AuthClaims added in v0.2.0

type AuthClaims struct {
	Claims string `json:"claims"`
}

type ConnectedDevice

type ConnectedDevice struct {
	UID      string    `json:"uid"`
	TenantID string    `json:"tenant_id" bson:"tenant_id"`
	LastSeen time.Time `json:"last_seen" bson:"last_seen"`
}

type Device

type Device struct {
	UID       string          `json:"uid"`
	Name      string          `json:"name" bson:"name,omitempty"`
	Identity  *DeviceIdentity `json:"identity"`
	Info      *DeviceInfo     `json:"info"`
	PublicKey string          `json:"public_key" bson:"public_key"`
	TenantID  string          `json:"tenant_id" bson:"tenant_id"`
	LastSeen  time.Time       `json:"last_seen" bson:"last_seen"`
	Online    bool            `json:"online" bson:",omitempty"`
	Namespace string          `json:"namespace" bson:",omitempty"`
}

type DeviceAuth

type DeviceAuth struct {
	Identity  *DeviceIdentity `json:"identity"`
	PublicKey string          `json:"public_key"`
	TenantID  string          `json:"tenant_id"`
}

type DeviceAuthClaims

type DeviceAuthClaims struct {
	UID string `json:"uid"`

	AuthClaims         `json:",squash"`
	jwt.StandardClaims `json:",squash"`
}

type DeviceAuthRequest

type DeviceAuthRequest struct {
	Info     *DeviceInfo `json:"info"`
	Sessions []string    `json:"sessions,omitempty"`
	*DeviceAuth
}

type DeviceAuthResponse

type DeviceAuthResponse struct {
	UID       string `json:"uid"`
	Token     string `json:"token"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type DeviceIdentity added in v0.2.1

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

type DeviceInfo added in v0.2.1

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

type Endpoints

type Endpoints struct {
	API string `json:"api"`
	SSH string `json:"ssh"`
}

type Info added in v0.2.1

type Info struct {
	Version   string    `json:"version"`
	Endpoints Endpoints `json:"endpoints"`
}

type MqttACLQuery

type MqttACLQuery struct {
	Access   string `query:"access"`
	Username string `query:"username"`
	Topic    string `query:"topic"`
	IPAddr   string `query:"ipaddr"`
}

type MqttAuthQuery

type MqttAuthQuery struct {
	Username string `query:"username"`
	Password string `query:"password"`
	IPAddr   string `query:"ipaddr"`
}

type MqttClientEvent

type MqttClientEvent struct {
	ClientID string `json:"client_id"`
	Username string `json:"username"`
}

type MqttEvent

type MqttEvent struct {
	Action string `json:"action"`

	MqttClientEvent
}

type Session

type Session struct {
	UID           string    `json:"uid"`
	DeviceUID     UID       `json:"device_uid,omitempty" bson:"device_uid"`
	Device        *Device   `json:"device" bson:",omitempty"`
	TenantID      string    `json:"tenant_id" bson:"tenant_id"`
	Username      string    `json:"username"`
	IPAddress     string    `json:"ip_address" bson:"ip_address"`
	StartedAt     time.Time `json:"started_at" bson:"started_at"`
	LastSeen      time.Time `json:"last_seen" bson:"last_seen"`
	Active        bool      `json:"active" bson:",omitempty"`
	Authenticated bool      `json:"authenticated" bson:"authenticated"`
}

type Stats

type Stats struct {
	RegisteredDevices int `json:"registered_devices"`
	OnlineDevices     int `json:"online_devices"`
	ActiveSessions    int `json:"active_sessions"`
}

type UID

type UID string

type User

type User struct {
	Username string `json:"username"`
	Password string `json:"password"`
	TenantID string `json:"tenant_id" bson:"tenant_id"`
}

type UserAuthClaims

type UserAuthClaims struct {
	Name   string `json:"name"`
	Admin  bool   `json:"admin"`
	Tenant string `json:"tenant"`

	AuthClaims         `json:",squash"`
	jwt.StandardClaims `json:",squash"`
}

type UserAuthRequest

type UserAuthRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type UserAuthResponse

type UserAuthResponse struct {
	Token  string `json:"token"`
	User   string `json:"user"`
	Tenant string `json:"tenant"`
}

Jump to

Keyboard shortcuts

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