models

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

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   map[string]string `json:"identity"`
	Attributes map[string]string `json:"attributes"`
	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"`
	Version    string            `json:"version"`
}

type DeviceAuth

type DeviceAuth struct {
	Identity  map[string]string `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 {
	Attributes map[string]string `json:"attributes"`
	Sessions   []string          `json:"sessions,omitempty"`
	Version    string            `json:"version"`
	*DeviceAuth
}

type DeviceAuthResponse

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

type Endpoints

type Endpoints struct {
	API string
	SSH string
}

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

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