scheme

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: GPL-3.0 Imports: 0 Imported by: 2

Documentation

Overview

Package scheme defines the request and response schemes for the API client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheOptions

type CacheOptions struct {
	Device      DeviceOptions      `json:"device" yaml:"device" mapstructure:"device"`
	Transaction TransactionOptions `json:"transaction" yaml:"transaction" mapstructure:"transaction"`
}

CacheOptions is the config options for cache.

type CapabilitiesOptions

type CapabilitiesOptions struct {
	Mode  string            `json:"mode" yaml:"mode" mapstructure:"mode"`
	Read  map[string]string `json:"read" yaml:"read" mapstructure:"read"`
	Write WriteOptions      `json:"write" yaml:"write" mapstructure:"write"`
}

CapabilitiesOptions holds the capabilities info.

type CheckOptions

type CheckOptions struct {
	Name      string `json:"name" yaml:"name" mapstructure:"name"`
	Status    string `json:"status" yaml:"status" mapstructure:"status"`
	Message   string `json:"message" yaml:"message" mapstructure:"message"`
	Timestamp string `json:"timestamp" yaml:"timestamp" mapstructure:"timestamp"`
	Type      string `json:"type" yaml:"type" mapstructure:"type"`
}

CheckOptions holds the health check info.

type Config

type Config struct {
	Logging    string           `json:"logging" yaml:"logging" mapstructure:"logging"`
	Plugin     PluginOptions    `json:"plugin" yaml:"plugin" mapstructure:"plugin"`
	Cache      CacheOptions     `json:"cache" yaml:"cache" mapstructure:"cache"`
	GRPC       GRPCOptions      `json:"grpc" yaml:"grpc" mapstructure:"grpc"`
	Transport  TransportOptions `json:"transport" yaml:"transport" mapstructure:"transport"`
	Metrics    MetricsOptions   `json:"metrics" yaml:"metrics" mapstructure:"metrics"`
	PrettyJSON bool             `json:"pretty_json" yaml:"pretty_json" mapstructure:"pretty_json"`
}

Config describes a response for `/config` endpoint.

type DeviceData

type DeviceData struct {
	Device string `json:"device" yaml:"device" mapstructure:"device"`
}

DeviceData describes the data for response/info event.

type DeviceOptions

type DeviceOptions struct {
	TTL          int `json:"ttl" yaml:"ttl" mapstructure:"ttl"`
	RebuildEvery int `json:"rebuild_every" yaml:"rebuild_every" mapstructure:"rebuild_every"`
}

DeviceOptions is the config options for device cache.

type DiscoveryOptions

type DiscoveryOptions struct {
	Kubernetes KubernetesOptions `json:"kubernetes" yaml:"kubernetes" mapstructure:"kubernetes"`
}

DiscoveryOptions is the config options for service discovery.

type EndpointsOptions

type EndpointsOptions struct {
	Labels map[string]string `json:"labels" yaml:"labels" mapstructure:"labels"`
}

EndpointsOptions is the config options for kubernetes's endpoint.

type Error

type Error struct {
	HTTPCode    int    `json:"http_code" yaml:"http_code" mapstructure:"http_code"`
	Description string `json:"description" yaml:"description" mapstructure:"description"`
	Timestamp   string `json:"timestamp" yaml:"timestamp" mapstructure:"timestamp"`
	Context     string `json:"context" yaml:"context" mapstructure:"context"`
}

Error describes an error response.

type EventMeta

type EventMeta struct {
	ID    uint64 `json:"id" yaml:"id" mapstructure:"id"`
	Event string `json:"event" yaml:"event" mapstructure:"event"`
}

EventMeta describes core elements in a event request/response scheme.

type GRPCOptions

type GRPCOptions struct {
	Timeout int        `json:"timeout" yaml:"timeout" mapstructure:"timeout"`
	TLS     TLSOptions `json:"tls" yaml:"tls" mapstructure:"tls"`
}

GRPCOptions is the config options for grpc.

type HealthOptions

type HealthOptions struct {
	Timestamp string         `json:"timestamp" yaml:"timestamp" mapstructure:"timestamp"`
	Status    string         `json:"status" yaml:"status" mapstructure:"status"`
	Message   string         `json:"message" yaml:"message" mapstructure:"message"`
	Checks    []CheckOptions `json:"checks" yaml:"checks" mapstructure:"checks"`
}

HealthOptions holds health info.

type Info

type Info struct {
	Timestamp    string              `json:"timestamp" yaml:"timestamp" mapstructure:"timestamp"`
	ID           string              `json:"id" yaml:"id" mapstructure:"id"`
	Alias        string              `json:"alias" yaml:"alias" mapstructure:"alias"`
	Type         string              `json:"type" yaml:"type" mapstructure:"type"`
	Metadata     map[string]string   `json:"metadata" yaml:"metadata" mapstructure:"metadata"`
	Plugin       string              `json:"plugin" yaml:"plugin" mapstructure:"plugin"`
	Info         string              `json:"info" yaml:"info" mapstructure:"info"`
	SortIndex    int                 `json:"sort_index" yaml:"sort_index" mapstructure:"sort_index"`
	Tags         []string            `json:"tags" yaml:"tags" mapstructure:"tags"`
	Capabilities CapabilitiesOptions `json:"capabilities" yaml:"capabilities" mapstructure:"capabilities"`
	Outputs      []OutputOptions     `json:"outputs" yaml:"outputs" mapstructure:"outputs"`
}

Info describes a response from `/info` endpoint.

type KubernetesOptions

type KubernetesOptions struct {
	Namespace string           `json:"namespace" yaml:"namespace" mapstructure:"namespace"`
	Endpoints EndpointsOptions `json:"endpoints" yaml:"endpoints" mapstructure:"endpoints"`
}

KubernetesOptions is the config options for kubernetes.

type MetricsOptions

type MetricsOptions struct {
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
}

MetricsOptions is the config options for metrics.

type NetworkOptions

type NetworkOptions struct {
	Protocol string `json:"protocol" yaml:"protocol" mapstructure:"protocol"`
	Address  string `json:"address" yaml:"address" mapstructure:"address"`
}

NetworkOptions holds communication protocol info.

type OutputOptions

type OutputOptions struct {
	Name          string      `json:"name" yaml:"name" mapstructure:"name"`
	Type          string      `json:"type" yaml:"type" mapstructure:"type"`
	Precision     int         `json:"precision" yaml:"precision" mapstructure:"precision"`
	ScalingFactor float64     `json:"scaling_factor" yaml:"scaling_factor" mapstructure:"scaling_factor"`
	Unit          UnitOptions `json:"unit" yaml:"unit" mapstructure:"unit"`
}

OutputOptions holds the output info.

type Plugin

type Plugin struct {
	PluginMeta `mapstructure:",squash"`
	Network    NetworkOptions `json:"network" yaml:"network" mapstructure:"network"`
	Health     HealthOptions  `json:"health" yaml:"health" mapstructure:"health"`
}

Plugin describes a response for `plugin` endpoint when the `id` URI parameter is provided.

type PluginData

type PluginData struct {
	Plugin string `json:"plugin" yaml:"plugin" mapstructure:"plugin"`
}

PluginData describes the data for request/plugin event.

type PluginHealth

type PluginHealth struct {
	Status    string   `json:"status" yaml:"status" mapstructure:"status"`
	Updated   string   `json:"updated" yaml:"updated" mapstructure:"updated"`
	Healthy   []string `json:"healthy" yaml:"healthy" mapstructure:"healthy"`
	Unhealthy []string `json:"unhealthy" yaml:"unhealthy" mapstructure:"unhealthy"`
	Active    int      `json:"active" yaml:"active" mapstructure:"active"`
	Inactive  int      `json:"inactive" yaml:"inactive" mapstructure:"inactive"`
}

PluginHealth describes a response for `plugin/health` endpoint.

type PluginMeta

type PluginMeta struct {
	Active      bool           `json:"active" yaml:"active" mapstructure:"active"`
	ID          string         `json:"id" yaml:"id" mapstructure:"id"`
	Name        string         `json:"name" yaml:"name" mapstructure:"name"`
	Description string         `json:"description" yaml:"description" mapstructure:"description"`
	Maintainer  string         `json:"maintainer" yaml:"maintainer" mapstructure:"maintainer"`
	Tag         string         `json:"tag" yaml:"tag" mapstructure:"tag"`
	VCS         string         `json:"vcs" yaml:"vcs" mapstructure:"vcs"`
	Version     VersionOptions `json:"version" yaml:"version" mapstructure:"version"`
}

PluginMeta holds the plugin metainfo.

type PluginOptions

type PluginOptions struct {
	TCP      []string         `json:"tcp" yaml:"tcp" mapstructure:"tcp"`
	Unix     []string         `json:"unix" yaml:"unix" mapstructure:"unix"`
	Discover DiscoveryOptions `json:"discover" yaml:"discover" mapstructure:"discover"`
}

PluginOptions is the config options for plugin.

type Read

type Read struct {
	Device     string                 `json:"device" yaml:"device" mapstructure:"device"`
	DeviceType string                 `json:"device_type" yaml:"device_type" mapstructure:"device_type"`
	Type       string                 `json:"type" yaml:"type" mapstructure:"type"`
	Value      interface{}            `json:"value" yaml:"value" mapstructure:"value"`
	Timestamp  string                 `json:"timestamp" yaml:"timestamp" mapstructure:"timestamp"`
	Unit       UnitOptions            `json:"unit" yaml:"unit" mapstructure:"unit"`
	Context    map[string]interface{} `json:"context" yaml:"context" mapstructure:"context"`
}

Read describes a unit in a response for `/read` endpoint.

type ReadCacheOptions

type ReadCacheOptions struct {
	Start string `json:"start,omitempty" yaml:"start,omitempty" mapstructure:"start"`
	End   string `json:"end,omitempty" yaml:"end,omitempty" mapstructure:"end"`
}

ReadCacheOptions describes the query parameters for `/readcache` endpoint.

type ReadDeviceData

type ReadDeviceData struct {
	Device string `json:"device" yaml:"device" mapstructure:"device"`
}

ReadDeviceData describes the data for request/read_device event.

type ReadOptions

type ReadOptions struct {
	NS   string   `json:"ns,omitempty" yaml:"ns,omitempty" mapstructure:"ns"`
	Tags []string `json:"tags,omitempty" yaml:"tags,omitempty" mapstructure:"tags"`
}

ReadOptions describes the query parameters for `/read` endpoint.

type ReadStreamOptions

type ReadStreamOptions struct {
	Ids  []string `json:"ids,omitempty" yaml:"ids,omitempty" mapstructure:"ids"`
	Stop bool     `json:"stop,omitempty" yaml:"stop,omitempty" mapstructure:"stop"`
	Tags []string `json:"tags,omitempty" yaml:"tags,omitempty" mapstructure:"tags"`
}

ReadStreamOptions describe the query parameters for the streamed readings endpoint.

type RequestConfig

type RequestConfig struct {
	EventMeta `mapstructure:",squash"`
}

RequestConfig describes a scheme for request/config event.

type RequestInfo

type RequestInfo struct {
	EventMeta `mapstructure:",squash"`
	Data      DeviceData `json:"data" yaml:"data" mapstructure:"data"`
}

RequestInfo describes a scheme for request/info event.

type RequestPlugin

type RequestPlugin struct {
	EventMeta `mapstructure:",squash"`
	Data      PluginData `json:"data" yaml:"data" mapstructure:"data"`
}

RequestPlugin describes a scheme for request/plugin event.

type RequestPluginHealth

type RequestPluginHealth struct {
	EventMeta `mapstructure:",squash"`
}

RequestPluginHealth describes a scheme for request/plugin_health event.

type RequestPlugins

type RequestPlugins struct {
	EventMeta `mapstructure:",squash"`
}

RequestPlugins describes a scheme for request/plugin event, with no plugin id being provided.

type RequestRead

type RequestRead struct {
	EventMeta `mapstructure:",squash"`
	Data      ReadOptions `json:"data" yaml:"data" mapstructure:"data"`
}

RequestRead describes a scheme for request/read event.

type RequestReadCache

type RequestReadCache struct {
	EventMeta `mapstructure:",squash"`
	Data      ReadCacheOptions `json:"data" yaml:"data" mapstructure:"data"`
}

RequestReadCache describes a scheme for request/read_cache event.

type RequestReadDevice

type RequestReadDevice struct {
	EventMeta `mapstructure:",squash"`
	Data      ReadDeviceData `json:"data" yaml:"data" mapstructure:"data"`
}

RequestReadDevice describes a scheme for request/read_device event.

type RequestReadStream

type RequestReadStream struct {
	EventMeta `mapstructure:",squash"`
	Data      ReadStreamOptions `json:"data" yaml:"data" mapstructure:"data"`
}

RequestReadStream describes a scheme for the request/read_stream event.

type RequestScan

type RequestScan struct {
	EventMeta `mapstructure:",squash"`
	Data      ScanOptions `json:"data" yaml:"data" mapstructure:"data"`
}

RequestScan describes a scheme for request/scan event.

type RequestStatus

type RequestStatus struct {
	EventMeta `mapstructure:",squash"`
}

RequestStatus describes a scheme for request/status event.

type RequestTags

type RequestTags struct {
	EventMeta `mapstructure:",squash"`
	Data      TagsOptions `json:"data" yaml:"data" mapstructure:"data"`
}

RequestTags describes a scheme for request/tags event.

type RequestTransaction

type RequestTransaction struct {
	EventMeta `mapstructure:",squash"`
	Data      WriteData `json:"data" yaml:"data" mapstructure:"data"`
}

RequestTransaction describes a scheme for request/transaction event.

type RequestTransactions

type RequestTransactions struct {
	EventMeta `mapstructure:",squash"`
}

RequestTransactions describes a scheme for request/transaction event with no transaction id being provided.

type RequestVersion

type RequestVersion struct {
	EventMeta `mapstructure:",squash"`
}

RequestVersion describes a scheme for request/version event.

type RequestWrite

type RequestWrite struct {
	EventMeta `mapstructure:",squash"`
	Data      RequestWriteData `json:"data" yaml:"data" mapstructure:"data"`
}

RequestWrite describes a scheme for request/write_async and request/write_sync event.

type RequestWriteData

type RequestWriteData struct {
	Device  string      `json:"device" yaml:"device" mapstructure:"device"`
	Payload []WriteData `json:"payload" yaml:"payload" mapstructure:"payload"`
}

RequestWriteData describes the data for request/write_async and request/write_sync event.

type Response

type Response struct {
	EventMeta `mapstructure:",squash"`
	Data      interface{} `json:"data" yaml:"data" mapstructure:"data"`
}

Response describes a generic response scheme.

type Scan

type Scan struct {
	ID       string                 `json:"id" yaml:"id" mapstructure:"id"`
	Alias    string                 `json:"alias" yaml:"alias" mapstructure:"alias"`
	Info     string                 `json:"info" yaml:"info" mapstructure:"info"`
	Type     string                 `json:"type" yaml:"type" mapstructure:"type"`
	Plugin   string                 `json:"plugin" yaml:"plugin" mapstructure:"plugin"`
	Tags     []string               `json:"tags" yaml:"tags" mapstructure:"tags"`
	Metadata map[string]interface{} `json:"metadata" yaml:"metadata" mapstructure:"metadata"`
}

Scan describes a unit in a response of `/scan` endpoint.

type ScanOptions

type ScanOptions struct {
	NS    string   `json:"ns,omitempty" yaml:"ns,omitempty" mapstructure:"ns"`
	Tags  []string `json:"tags,omitempty" yaml:"tags,omitempty" mapstructure:"tags"`
	Force bool     `json:"force,omitempty" yaml:"force,omitempty" mapstructure:"force"`
	Sort  []string `json:"sort,omitempty" yaml:"sort,omitempty" mapstructure:"sort"`
}

ScanOptions describes the query parameters for `/scan` endpoint.

type Status

type Status struct {
	Status    string `json:"status" yaml:"status" mapstructure:"status"`
	Timestamp string `json:"timestamp" yaml:"timestamp" mapstructure:"timestamp"`
}

Status describes a response for `/test` endpoint.

type TLSOptions

type TLSOptions struct {
	Cert string `json:"cert" yaml:"cert" mapstructure:"cert"`
}

TLSOptions is the config options for tls communication.

type TagsOptions

type TagsOptions struct {
	NS  []string `json:"ns,omitempty" yaml:"ns,omitempty" mapstructure:"ns"`
	IDs bool     `json:"ids,omitempty" yaml:"ids,omitempty" mapstructure:"ids"`
}

TagsOptions describes the query parameters for `/tags` endpoint.

type Transaction

type Transaction struct {
	ID      string    `json:"id" yaml:"id" mapstructure:"id"`
	Timeout string    `json:"timeout" yaml:"timeout" mapstructure:"timeout"`
	Device  string    `json:"device" yaml:"device" mapstructure:"device"`
	Context WriteData `json:"context" yaml:"context" mapstructure:"context"`
	Status  string    `json:"status" yaml:"status" mapstructure:"status"`
	Created string    `json:"created" yaml:"created" mapstructure:"created"`
	Updated string    `json:"updated" yaml:"updated" mapstructure:"updated"`
	Message string    `json:"message" yaml:"message" mapstructure:"message"`
}

Transaction describes a response for `/transaction` endpoint. It also describes an unit in a response for `/write/wait` endpoint.

type TransactionOptions

type TransactionOptions struct {
	TTL int `json:"ttl" yaml:"ttl" mapstructure:"ttl"`
}

TransactionOptions is the config options for transaction cache.

type TransportOptions

type TransportOptions struct {
	HTTP      bool `json:"http" yaml:"http" mapstructure:"http"`
	WebSocket bool `json:"websocket" yaml:"websocket" mapstructure:"websocket"`
}

TransportOptions is the config options for transport communication layer.

type UnitOptions

type UnitOptions struct {
	Name   string `json:"name" yaml:"name" mapstructure:"name"`
	Symbol string `json:"symbol" yaml:"symbol" mapstructure:"symbol"`
}

UnitOptions holds the unit info.

type Version

type Version struct {
	Version    string `json:"version" yaml:"version" mapstructure:"version"`
	APIVersion string `json:"api_version" yaml:"api_version" mapstructure:"api_version"`
}

Version describes a response for `version` endpoint.

type VersionOptions

type VersionOptions struct {
	PluginVersion string `json:"plugin_version" yaml:"plugin_version" mapstructure:"plugin_version"`
	SDKVersion    string `json:"sdk_version" yaml:"sdk_version" mapstructure:"sdk_version"`
	BuildDate     string `json:"build_date" yaml:"build_date" mapstructure:"build_date"`
	GitCommit     string `json:"git_commit" yaml:"git_commit" mapstructure:"git_commit"`
	GitTag        string `json:"git_tag" yaml:"git_tag" mapstructure:"git_tag"`
	Arch          string `json:"arch" yaml:"arch" mapstructure:"arch"`
	OS            string `json:"os" yaml:"os" mapstructure:"os"`
}

VersionOptions holds the version info.

type Write

type Write struct {
	ID      string    `json:"id" yaml:"id" mapstructure:"id"`
	Device  string    `json:"device" yaml:"device" mapstructure:"device"`
	Context WriteData `json:"context" yaml:"context" mapstructure:"context"`
	Timeout string    `json:"timeout" yaml:"timeout" mapstructure:"timeout"`
}

Write describes an unit in a response for the `/write` endpoint.

type WriteData

type WriteData struct {
	Transaction string `json:"transaction,omitempty" yaml:"transaction,omitempty" mapstructure:"transaction"`
	Action      string `json:"action" yaml:"action" mapstructure:"action"`

	// data is always string, as the conversion happens on the plugin side.
	Data string `json:"data,omitempty" yaml:"data,omitempty" mapstructure:"data"`
}

WriteData describes an unit in the POST body for the `/write` endpoint. This can also be used in a websocket request event payload.

type WriteOptions

type WriteOptions struct {
	Actions []string `json:"actions" yaml:"actions" mapstructure:"actions"`
}

WriteOptions holds the write info.

Jump to

Keyboard shortcuts

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