node

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: AGPL-3.0 Imports: 9 Imported by: 14

README

apiserviceNode

The apiservice Node is the implementation of the node part from the unified api. The api service node is available in all Perinets Products.

This implementation does store its resources, e.g. NodeInfo object or the ProductionInfo object persistently in the file system /var/lib/apiservice-node/ as json files.

References

Dual License

This software is by default licensed via the GNU Affero General Public License version 3. However it is also available with a commercial license on request (https://perinet.io/contact).

Documentation

Overview

Container dedicated implementation for the API service Node of Perinets unified API. It provides node specific meta information, general funding configuration values like application_name and element_name as well as production information

Index

Constants

View Source
const (
	API_VERSION = "23"
)

Variables

View Source
var NodeLifeState = struct {
	PRODUCTION string
	OEM        string
	UPDATED    string
}{
	"PRODUCTION",
	"OEM",
	"UPDATED",
}

LifeCycle State of a node enumerator

var state = NodeLifeState.PRODUCED
View Source
var NodeStatus = struct {
	NO_ERROR string
	WARNING  string
	ERROR    string
	CRITICAL string
	FATAL    string
}{
	"NO_ERROR",
	"WARNING",
	"ERROR",
	"CRITICAL",
	"FATAL",
}

Functions

func LifeStateSet

func LifeStateSet(w http.ResponseWriter, r *http.Request)

func NodeConfigGet

func NodeConfigGet(w http.ResponseWriter, r *http.Request)

func NodeConfigSet

func NodeConfigSet(w http.ResponseWriter, r *http.Request)

func NodeInfoGet

func NodeInfoGet(w http.ResponseWriter, r *http.Request)

func ProductionInfoGet

func ProductionInfoGet(w http.ResponseWriter, r *http.Request)

func ProductionInfoSet

func ProductionInfoSet(w http.ResponseWriter, r *http.Request)

func ServicesGet

func ServicesGet(w http.ResponseWriter, r *http.Request)

func ServicesSet

func ServicesSet(w http.ResponseWriter, r *http.Request)

func SetServiceConfig

func SetServiceConfig(serviceConfig ServiceConfig)

func StatusReset

func StatusReset(w http.ResponseWriter, r *http.Request)

func StatusSet

func StatusSet(w http.ResponseWriter, r *http.Request)

Types

type ContainerMetaInfo

type ContainerMetaInfo struct {
	Version   string `json:"version"`
	Container string `json:"container"`
	Support   string `json:"support"`
	Mantainer string `json:"mantainer"`
}

type FirmwareInfo

type FirmwareInfo struct {
	Version   string `json:"version"`
	Name      string `json:"name"`
	Specifier string `json:"specifier"`
}

type NodeConfig

type NodeConfig struct {
	ApplicationName string `json:"application_name"`
	ElementName     string `json:"element_name"`
}

type NodeInfo

type NodeInfo struct {
	ApiVersion json.Number `json:"api_version"`

	Config *NodeConfig `json:"config"`

	LifeState string `json:"life_state"`

	Services []string `json:"services"`

	Status string `json:"status"`

	Firmware FirmwareInfo `json:"firmware"`
}

NodeInfo - Basic Node information

type PathInfo

type PathInfo = httpserver.PathInfo

func PathsGet

func PathsGet() []PathInfo

Get a list of public available paths

type ProductionInfo

type ProductionInfo struct {
	Manufacturer string `json:"manufacturer"`

	// Manufacturer Part Number
	Mpn string `json:"mpn"`

	SerialNumber string `json:"serial_number"`

	ProductVersion string `json:"product_version"`

	ProductVariant string `json:"product_variant"`

	// Manufacturer production batch identification
	BatchNumber string `json:"batch_number"`

	ProductName string `json:"product_name"`

	Country string `json:"country"`

	Hostname string `json:"hostname"`
}

type ServiceConfig

type ServiceConfig struct {
	FirmwareInfo      FirmwareInfo
	StorageBasePath   string
	NodeEventCallback func()
}

Jump to

Keyboard shortcuts

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