cloudprotocol

package
v0.0.0-...-a7ee241 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 23

Documentation

Index

Constants

View Source
const (
	DesiredStatusType          = "desiredStatus"
	RequestLogType             = "requestLog"
	ServiceDiscoveryType       = "serviceDiscovery"
	StateAcceptanceType        = "stateAcceptance"
	UpdateStateType            = "updateState"
	DeviceErrors               = "deviceErrors"
	RenewCertsNotificationType = "renewCertificatesNotification"
	IssuedUnitCertsType        = "issuedUnitCertificates"
	OverrideEnvVarsType        = "overrideEnvVars"
)

Cloud message types.

View Source
const (
	AlertsType                       = "alerts"
	MonitoringDataType               = "monitoringData"
	NewStateType                     = "newState"
	PushLogType                      = "pushLog"
	StateRequestType                 = "stateRequest"
	UnitStatusType                   = "unitStatus"
	IssueUnitCertsType               = "issueUnitCertificates"
	InstallUnitCertsConfirmationType = "installUnitCertificatesConfirmation"
	OverrideEnvVarsStatusType        = "overrideEnvVarsStatus"
)

Device message types.

View Source
const (
	AlertTagSystemError      = "systemAlert"
	AlertTagAosCore          = "coreAlert"
	AlertTagResourceValidate = "resourceValidateAlert"
	AlertTagDeviceAllocate   = "deviceAllocateAlert"
	AlertTagSystemQuota      = "systemQuotaAlert"
	AlertTagInstanceQuota    = "instanceQuotaAlert"
	AlertTagDownloadProgress = "downloadProgressAlert"
	AlertTagServiceInstance  = "serviceInstanceAlert"
)

Alert tags.

View Source
const (
	UnknownStatus     = "unknown"
	PendingStatus     = "pending"
	DownloadingStatus = "downloading"
	DownloadedStatus  = "downloaded"
	InstallingStatus  = "installing"
	InstalledStatus   = "installed"
	RemovingStatus    = "removing"
	RemovedStatus     = "removed"
	ErrorStatus       = "error"
)

Unit statuses.

View Source
const (
	ForceUpdate     = "force"
	TriggerUpdate   = "trigger"
	TimetableUpdate = "timetable"
)

SOTA/FOTA schedule type.

View Source
const (
	InstanceStateActive = "active"
	InstanceStateFailed = "failed"
)

Service instance states.

View Source
const (
	DownloadTargetComponent = "component"
	DownloadTargetLayer     = "layer"
	DownloadTargetService   = "service"
)

Download target types.

View Source
const (
	GenericPartition  = "generic"
	StoragesPartition = "storages"
	StatesPartition   = "states"
	ServicesPartition = "services"
	LayersPartition   = "layers"
)

Partition types.

View Source
const (
	SystemLog  = "systemLog"
	ServiceLog = "serviceLog"
	CrashLog   = "crashLog"
)

Log types.

View Source
const ProtocolVersion = 5

ProtocolVersion specifies supported protocol version.

View Source
const UnitSecretVersion = 2

UnitSecretVersion specifies supported version of UnitSecret message.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertItem

type AlertItem struct {
	Timestamp time.Time   `json:"timestamp"`
	Tag       string      `json:"tag"`
	Payload   interface{} `json:"payload"`
}

AlertItem alert item structure.

type Alerts

type Alerts []AlertItem

Alerts alerts message structure.

type Certificate

type Certificate struct {
	Fingerprint string `json:"fingerprint"`
	Certificate []byte `json:"certificate"`
}

Certificate certificate structure.

type CertificateChain

type CertificateChain struct {
	Name         string   `json:"name"`
	Fingerprints []string `json:"fingerprints"`
}

CertificateChain certificate chain.

type ComponentInfo

type ComponentInfo struct {
	aostypes.VersionInfo
	ID          string          `json:"id"`
	Annotations json.RawMessage `json:"annotations,omitempty"`
	DecryptDataStruct
}

ComponentInfo decrypted component info.

func (ComponentInfo) String

func (component ComponentInfo) String() string

type ComponentStatus

type ComponentStatus struct {
	ID            string     `json:"id"`
	AosVersion    uint64     `json:"aosVersion"`
	VendorVersion string     `json:"vendorVersion"`
	Status        string     `json:"status"`
	ErrorInfo     *ErrorInfo `json:"errorInfo,omitempty"`
}

ComponentStatus component status.

type ConnectionInfo

type ConnectionInfo struct {
	SendParams    SendParams    `json:"sendParams"`
	ReceiveParams ReceiveParams `json:"receiveParams"`
}

ConnectionInfo AMQP connection info.

type CoreAlert

type CoreAlert struct {
	NodeID        string `json:"nodeId"`
	CoreComponent string `json:"coreComponent"`
	Message       string `json:"message"`
}

CoreAlert system alert structure.

type DecryptDataStruct

type DecryptDataStruct struct {
	URLs           []string        `json:"urls"`
	Sha256         []byte          `json:"sha256"`
	Sha512         []byte          `json:"sha512"`
	Size           uint64          `json:"size"`
	DecryptionInfo *DecryptionInfo `json:"decryptionInfo,omitempty"`
	Signs          *Signs          `json:"signs,omitempty"`
}

DecryptDataStruct struct contains how to decrypt data.

type DecryptionInfo

type DecryptionInfo struct {
	BlockAlg     string `json:"blockAlg"`
	BlockIv      []byte `json:"blockIv"`
	BlockKey     []byte `json:"blockKey"`
	AsymAlg      string `json:"asymAlg"`
	ReceiverInfo *struct {
		Serial string `json:"serial"`
		Issuer []byte `json:"issuer"`
	} `json:"receiverInfo"`
}

DecryptionInfo update decryption info.

type DesiredStatus

type DesiredStatus struct {
	UnitConfig        json.RawMessage    `json:"unitConfig"`
	Components        []ComponentInfo    `json:"components"`
	Layers            []LayerInfo        `json:"layers"`
	Services          []ServiceInfo      `json:"services"`
	Instances         []InstanceInfo     `json:"instances"`
	FOTASchedule      ScheduleRule       `json:"fotaSchedule"`
	SOTASchedule      ScheduleRule       `json:"sotaSchedule"`
	CertificateChains []CertificateChain `json:"certificateChains,omitempty"`
	Certificates      []Certificate      `json:"certificates,omitempty"`
}

DesiredStatus desired status.

type DeviceAllocateAlert

type DeviceAllocateAlert struct {
	aostypes.InstanceIdent
	NodeID  string `json:"nodeId"`
	Device  string `json:"device"`
	Message string `json:"message"`
}

DeviceAllocateAlert device allocate alert structure.

type DownloadAlert

type DownloadAlert struct {
	TargetType          string `json:"targetType"`
	TargetID            string `json:"targetId"`
	TargetAosVersion    uint64 `json:"targetAosVersion"`
	TargetVendorVersion string `json:"targetVendorVersion"`
	Message             string `json:"message"`
	Progress            string `json:"progress"`
	URL                 string `json:"url"`
	DownloadedBytes     string `json:"downloadedBytes"`
	TotalBytes          string `json:"totalBytes"`
}

DownloadAlert download alert structure.

type EnvVarInfo

type EnvVarInfo struct {
	ID       string     `json:"id"`
	Variable string     `json:"variable"`
	TTL      *time.Time `json:"ttl"`
}

EnvVarInfo env info with id and time to live.

type EnvVarStatus

type EnvVarStatus struct {
	ID    string `json:"id"`
	Error string `json:"error,omitempty"`
}

EnvVarStatus env status with error message.

type EnvVarsInstanceInfo

type EnvVarsInstanceInfo struct {
	InstanceFilter
	EnvVars []EnvVarInfo `json:"envVars"`
}

EnvVarsInstanceInfo struct with envs and related service and user.

type EnvVarsInstanceStatus

type EnvVarsInstanceStatus struct {
	InstanceFilter
	Statuses []EnvVarStatus `json:"statuses"`
}

EnvVarsInstanceStatus struct with envs status and related service and user.

type ErrorInfo

type ErrorInfo struct {
	AosCode  int    `json:"aosCode"`
	ExitCode int    `json:"exitCode"`
	Message  string `json:"message,omitempty"`
}

ErrorInfo error information.

type ExchangeParams

type ExchangeParams struct {
	Name       string `json:"name"`
	Durable    bool   `json:"durable"`
	AutoDetect bool   `json:"autoDetect"`
	Internal   bool   `json:"internal"`
	NoWait     bool   `json:"noWait"`
}

ExchangeParams AMQP exchange parameters.

type InstallCertData

type InstallCertData struct {
	Type        string `json:"type"`
	NodeID      string `json:"nodeId,omitempty"`
	Serial      string `json:"serial"`
	Status      string `json:"status"`
	Description string `json:"description,omitempty"`
}

InstallCertData install certificate data.

type InstallUnitCertsConfirmation

type InstallUnitCertsConfirmation struct {
	Certificates []InstallCertData `json:"certificates"`
}

InstallUnitCertsConfirmation install unit certificates confirmation.

type InstanceFilter

type InstanceFilter struct {
	ServiceID *string `json:"serviceId,omitempty"`
	SubjectID *string `json:"subjectId,omitempty"`
	Instance  *uint64 `json:"instance,omitempty"`
}

InstanceFilter instance filter structure.

func NewInstanceFilter

func NewInstanceFilter(serviceID, subjectID string, instance int64) (filter InstanceFilter)

type InstanceInfo

type InstanceInfo struct {
	ServiceID    string   `json:"serviceId"`
	SubjectID    string   `json:"subjectId"`
	Priority     uint64   `json:"priority"`
	NumInstances uint64   `json:"numInstances"`
	Labels       []string `json:"labels"`
}

InstanceInfo decrypted desired instance runtime info.

type InstanceMonitoringData

type InstanceMonitoringData struct {
	aostypes.InstanceIdent
	MonitoringData
}

InstanceMonitoringData monitoring data for service.

type InstanceQuotaAlert

type InstanceQuotaAlert struct {
	aostypes.InstanceIdent
	Parameter string `json:"parameter"`
	Value     uint64 `json:"value"`
}

InstanceQuotaAlert instance quota alert structure.

type InstanceStatus

type InstanceStatus struct {
	aostypes.InstanceIdent
	AosVersion    uint64     `json:"aosVersion"`
	StateChecksum string     `json:"stateChecksum,omitempty"`
	RunState      string     `json:"runState"`
	NodeID        string     `json:"nodeId"`
	ErrorInfo     *ErrorInfo `json:"errorInfo,omitempty"`
}

InstanceStatus service instance runtime status.

type IssueCertData

type IssueCertData struct {
	Type   string `json:"type"`
	NodeID string `json:"nodeId,omitempty"`
	Csr    string `json:"csr"`
}

IssueCertData issue certificate data.

type IssueUnitCerts

type IssueUnitCerts struct {
	Requests []IssueCertData `json:"requests"`
}

IssueUnitCerts issue unit certificates request.

type IssuedCertData

type IssuedCertData struct {
	Type             string `json:"type"`
	NodeID           string `json:"nodeId,omitempty"`
	CertificateChain string `json:"certificateChain"`
}

IssuedCertData issued unit certificate data.

type IssuedUnitCerts

type IssuedUnitCerts struct {
	Certificates []IssuedCertData `json:"certificates"`
}

IssuedUnitCerts issued unit certificates info.

type LayerInfo

type LayerInfo struct {
	aostypes.VersionInfo
	ID     string `json:"id"`
	Digest string `json:"digest"`
	DecryptDataStruct
}

LayerInfo decrypted layer info.

func (LayerInfo) String

func (layer LayerInfo) String() string

type LayerStatus

type LayerStatus struct {
	ID         string     `json:"id"`
	AosVersion uint64     `json:"aosVersion"`
	Digest     string     `json:"digest"`
	Status     string     `json:"status"`
	ErrorInfo  *ErrorInfo `json:"errorInfo,omitempty"`
}

LayerStatus layer status.

type LogFilter

type LogFilter struct {
	From    *time.Time `json:"from"`
	Till    *time.Time `json:"till"`
	NodeIDs []string   `json:"nodeIds,omitempty"`
	InstanceFilter
}

LogFilter request log message.

type Message

type Message struct {
	Header MessageHeader `json:"header"`
	Data   interface{}   `json:"data"`
}

Message structure for AOS messages.

type MessageHeader

type MessageHeader struct {
	Version     uint64 `json:"version"`
	SystemID    string `json:"systemId"`
	MessageType string `json:"messageType"`
}

MessageHeader message header.

type Monitoring

type Monitoring struct {
	Nodes []NodeMonitoringData `json:"nodes"`
}

Monitoring monitoring message structure.

type MonitoringData

type MonitoringData struct {
	RAM        uint64           `json:"ram"`
	CPU        uint64           `json:"cpu"`
	InTraffic  uint64           `json:"inTraffic"`
	OutTraffic uint64           `json:"outTraffic"`
	Disk       []PartitionUsage `json:"disk"`
}

MonitoringData monitoring data.

type NewState

type NewState struct {
	aostypes.InstanceIdent
	Checksum string `json:"stateChecksum"`
	State    string `json:"state"`
}

NewState new state structure.

type NodeInfo

type NodeInfo struct {
	NodeID   string `json:"nodeId"`
	NodeType string `json:"nodeType"`
	SystemInfo
}

NodeInfo node information.

type NodeMonitoringData

type NodeMonitoringData struct {
	MonitoringData
	NodeID           string                   `json:"nodeId"`
	Timestamp        time.Time                `json:"timestamp"`
	ServiceInstances []InstanceMonitoringData `json:"serviceInstances"`
}

NodeMonitoringData node monitoring data.

type OverrideEnvVars

type OverrideEnvVars struct {
	OverrideEnvVars []EnvVarsInstanceInfo `json:"overrideEnvVars"`
}

OverrideEnvVars request to override service environment variables.

type OverrideEnvVarsStatus

type OverrideEnvVarsStatus struct {
	OverrideEnvVarsStatus []EnvVarsInstanceStatus `json:"overrideEnvVarsStatus"`
}

OverrideEnvVarsStatus override env status.

type PartitionInfo

type PartitionInfo struct {
	Name      string   `json:"name"`
	Types     []string `json:"types"`
	TotalSize uint64   `json:"totalSize"`
}

PartitionInfo partition information.

type PartitionUsage

type PartitionUsage struct {
	Name     string `json:"name"`
	UsedSize uint64 `json:"usedSize"`
}

PartitionUsage partition usage information.

type PushLog

type PushLog struct {
	NodeID     string     `json:"nodeId"`
	LogID      string     `json:"logId"`
	PartsCount uint64     `json:"partsCount,omitempty"`
	Part       uint64     `json:"part,omitempty"`
	Content    []byte     `json:"content,omitempty"`
	ErrorInfo  *ErrorInfo `json:"errorInfo,omitempty"`
}

PushLog push service log structure.

type QueueInfo

type QueueInfo struct {
	Name             string `json:"name"`
	Durable          bool   `json:"durable"`
	DeleteWhenUnused bool   `json:"deleteWhenUnused"`
	Exclusive        bool   `json:"exclusive"`
	NoWait           bool   `json:"noWait"`
}

QueueInfo AMQP queue info.

type ReceiveParams

type ReceiveParams struct {
	Host      string    `json:"host"`
	User      string    `json:"user"`
	Password  string    `json:"password"`
	Consumer  string    `json:"consumer"`
	AutoAck   bool      `json:"autoAck"`
	Exclusive bool      `json:"exclusive"`
	NoLocal   bool      `json:"noLocal"`
	NoWait    bool      `json:"noWait"`
	Queue     QueueInfo `json:"queue"`
}

ReceiveParams AMQP receive parameters.

type ReceivedMessage

type ReceivedMessage struct {
	Header MessageHeader `json:"header"`
	Data   []byte        `json:"data"`
}

ReceivedMessage structure for Aos incoming messages.

type RenewCertData

type RenewCertData struct {
	Type      string    `json:"type"`
	NodeID    string    `json:"nodeId,omitempty"`
	Serial    string    `json:"serial"`
	ValidTill time.Time `json:"validTill"`
}

RenewCertData renew certificate data.

type RenewCertsNotification

type RenewCertsNotification struct {
	Certificates []RenewCertData `json:"certificates"`
	UnitSecret   UnitSecret      `json:"unitSecret"`
}

RenewCertsNotification renew certificate notification from cloud with pwd.

type RequestLog

type RequestLog struct {
	LogID   string    `json:"logId"`
	LogType string    `json:"logType"`
	Filter  LogFilter `json:"filter"`
}

RequestLog request log message.

type ResourceValidateAlert

type ResourceValidateAlert struct {
	NodeID          string                  `json:"nodeId"`
	ResourcesErrors []ResourceValidateError `json:"resourcesErrors"`
}

ResourceValidateAlert resource validate alert structure.

type ResourceValidateError

type ResourceValidateError struct {
	Name   string   `json:"name"`
	Errors []string `json:"error"`
}

ResourceValidateError resource validate error structure.

type ScheduleRule

type ScheduleRule struct {
	TTL       uint64           `json:"ttl"`
	Type      string           `json:"type"`
	Timetable []TimetableEntry `json:"timetable"`
}

ScheduleRule rule for performing schedule update.

type SendParams

type SendParams struct {
	Host      string         `json:"host"`
	User      string         `json:"user"`
	Password  string         `json:"password"`
	Mandatory bool           `json:"mandatory"`
	Immediate bool           `json:"immediate"`
	Exchange  ExchangeParams `json:"exchange"`
}

SendParams AMQP send parameters.

type ServiceDiscoveryRequest

type ServiceDiscoveryRequest struct{}

ServiceDiscoveryRequest service discovery request.

type ServiceDiscoveryResponse

type ServiceDiscoveryResponse struct {
	Version    uint64         `json:"version"`
	Connection ConnectionInfo `json:"connection"`
}

ServiceDiscoveryResponse service discovery response.

type ServiceInfo

type ServiceInfo struct {
	aostypes.VersionInfo
	ID         string `json:"id"`
	ProviderID string `json:"providerId"`
	DecryptDataStruct
}

ServiceInfo decrypted service info.

func (ServiceInfo) String

func (service ServiceInfo) String() string

type ServiceInstanceAlert

type ServiceInstanceAlert struct {
	aostypes.InstanceIdent
	AosVersion uint64 `json:"aosVersion"`
	Message    string `json:"message"`
}

ServiceInstanceAlert system alert structure.

type ServiceStatus

type ServiceStatus struct {
	ID         string     `json:"id"`
	AosVersion uint64     `json:"aosVersion"`
	Status     string     `json:"status"`
	ErrorInfo  *ErrorInfo `json:"errorInfo,omitempty"`
}

ServiceStatus service status.

type Signs

type Signs struct {
	ChainName        string   `json:"chainName"`
	Alg              string   `json:"alg"`
	Value            []byte   `json:"value"`
	TrustedTimestamp string   `json:"trustedTimestamp"`
	OcspValues       []string `json:"ocspValues"`
}

Signs message signature.

type StateAcceptance

type StateAcceptance struct {
	aostypes.InstanceIdent
	Checksum string `json:"checksum"`
	Result   string `json:"result"`
	Reason   string `json:"reason"`
}

StateAcceptance state acceptance message.

type StateRequest

type StateRequest struct {
	aostypes.InstanceIdent
	Default bool `json:"default"`
}

StateRequest state request structure.

type SystemAlert

type SystemAlert struct {
	NodeID  string `json:"nodeId"`
	Message string `json:"message"`
}

SystemAlert system alert structure.

type SystemInfo

type SystemInfo struct {
	NumCPUs    uint64          `json:"numCpus"`
	TotalRAM   uint64          `json:"totalRam"`
	Partitions []PartitionInfo `json:"partitions"`
}

SystemInfo system information.

type SystemQuotaAlert

type SystemQuotaAlert struct {
	NodeID    string `json:"nodeId"`
	Parameter string `json:"parameter"`
	Value     uint64 `json:"value"`
}

SystemQuotaAlert system quota alert structure.

type TimeSlot

type TimeSlot struct {
	Start  aostypes.Time `json:"start"`
	Finish aostypes.Time `json:"finish"`
}

TimeSlot time slot with start and finish time.

type TimetableEntry

type TimetableEntry struct {
	DayOfWeek uint       `json:"dayOfWeek"`
	TimeSlots []TimeSlot `json:"timeSlots"`
}

TimetableEntry entry for update timetable.

type UnitConfigStatus

type UnitConfigStatus struct {
	VendorVersion string     `json:"vendorVersion"`
	Status        string     `json:"status"`
	ErrorInfo     *ErrorInfo `json:"errorInfo,omitempty"`
}

UnitConfigStatus unit config status.

type UnitSecret

type UnitSecret struct {
	Version int `json:"version"`
	Data    struct {
		OwnerPassword string `json:"ownerPassword"`
	} `json:"data"`
}

UnitSecret keeps unit secret used to decode secure device password.

type UnitStatus

type UnitStatus struct {
	UnitConfig   []UnitConfigStatus `json:"unitConfig"`
	Services     []ServiceStatus    `json:"services"`
	Layers       []LayerStatus      `json:"layers,omitempty"`
	Components   []ComponentStatus  `json:"components"`
	Instances    []InstanceStatus   `json:"instances"`
	UnitSubjects []string           `json:"unitSubjects"`
	Nodes        []NodeInfo         `json:"nodes"`
}

UnitStatus unit status structure.

type UpdateState

type UpdateState struct {
	aostypes.InstanceIdent
	Checksum string `json:"stateChecksum"`
	State    string `json:"state"`
}

UpdateState state update message.

Jump to

Keyboard shortcuts

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