helpers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDeviceAttribute

func AddDeviceAttribute(device dttype.Device, attributeName string, attributeValue string, attributeType string)

Function to add Device attribute to existing device

func AddTwinAttribute

func AddTwinAttribute(device dttype.Device, attributeName string, attributeValue string, attributeType string)

Function to add Twin attribute to existing device

func CheckPodDeletion

func CheckPodDeletion(EdgedEndPoint, UID string)

CheckPodDeletion is function to check pod deletion

func CheckPodRunningState

func CheckPodRunningState(EdgedEndPoint, podname string)

CheckPodRunningState is function to check the Pod state

func CreateDevice

func CreateDevice(deviceID string, deviceName string, deviceState string) dttype.Device

Function to Generate Device

func GenerateDeviceID

func GenerateDeviceID(deviceSuffix string) string

func GetDeviceStateFromDB

func GetDeviceStateFromDB(deviceID string) string

Function to access the edge_core DB and return the device state.

func GetPods

func GetPods(EdgedEndpoint string) (v1.PodList, error)

Function to get the pods from Edged

func HandleAddAndDeleteDevice

func HandleAddAndDeleteDevice(operation, testMgrEndPoint string, device dttype.Device) bool

function to handle device addition and deletion.

func HandleAddAndDeletePods

func HandleAddAndDeletePods(operation string, edgedpoint string, UID string, container []v1.Container, restart_policy v1.RestartPolicy) bool

HandleAddAndDeletePods is function to handle app deployment/delete deployment.

func HubClientInit

func HubClientInit(server, clientID, username, password string) *MQTT.ClientOptions

HubclientInit create mqtt client config

Types

type Attribute

type Attribute struct {
	ID          string `json:"id,omitempty"`
	DeviceID    string `json:"deviceid,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Value       string `json:"value,omitempty"`
	Optional    bool   `json:"optional,omitempty"`
	Type        string `json:"attr_type,omitempty"`
	MetaData    string `json:"metadata,omitempty"`
}

Attribute Structure to read data from DB (Should match with the DB-table 'device_attr' schema)

func GetDeviceAttributesFromDB

func GetDeviceAttributesFromDB(deviceID string, Name string) Attribute

type Device

type Device struct {
	ID          string `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	State       string `json:"state,omitempty"`
	LastOnline  string `json:"last_online,omitempty"`
}

Device the struct of device

type DeviceUpdate

type DeviceUpdate struct {
	State      string                     `json:"state,omitempty"`
	Attributes map[string]*dttype.MsgAttr `json:"attributes"`
}

DeviceUpdate device update

type TwinAttribute

type TwinAttribute struct {
	ID           string `json:"id,omitempty"`
	DeviceID     string `json:"deviceid,omitempty"`
	Name         string `json:"name,omitempty"`
	Description  string `json:"description,omitempty"`
	Expected     string `json:"expected,omitempty"`
	Actual       string `json:"actual,omitempty"`
	ExpectedMeta string `json:"expected_meta,omitempty"`
	ActualMeta   string `json:"actual_meta,omitempty"`
	ExpectedVer  string `json:"expected_version,omitempty"`
	ActualVer    string `json:"actual_version,omitempty"`
	Optional     bool   `json:"optional,omitempty"`
	Type         string `json:"attr_type,omitempty"`
	MetaData     string `json:"metadata,omitempty"`
}

Twin Structure to read data from DB (Should match with the DB-table 'device_twin' schema)

func GetTwinAttributesFromDB

func GetTwinAttributesFromDB(deviceID string, Name string) TwinAttribute

Jump to

Keyboard shortcuts

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