models

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: Apache-2.0 Imports: 3 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 {
	ID       bson.ObjectId `json:"-" bson:"_id,omitempty"`
	UID      UID           `json:"uid"`
	LastSeen time.Time     `json:"last_seen" bson:"last_seen"`
}

type ConnectedDevice

type ConnectedDevice struct {
	ID       bson.ObjectId `json:"-" bson:"_id,omitempty"`
	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 {
	ID         bson.ObjectId     `json:"-" bson:"_id,omitempty"`
	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"`
	Online     bool              `json:"online"`
	Namespace  string            `json:"namespace"`
}

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

	jwt.StandardClaims
}

type DeviceAuthRequest

type DeviceAuthRequest struct {
	Attributes map[string]string `json:"attributes"`
	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 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 {
	ID        bson.ObjectId `json:"-" bson:"_id,omitempty"`
	UID       string        `json:"uid"`
	Device    UID           `json:"device"`
	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"`
}

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 {
	ID       bson.ObjectId `json:"-" bson:"_id,omitempty"`
	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"`

	jwt.StandardClaims
}

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