models

package
v0.0.0-...-7ff6187 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SimulationStatusReady specifies that the simulation is ready to run or provision devices.
	SimulationStatusReady SimulationStatus = "ready"
	// SimulationStatusRunning specifies that the simulation is running.
	SimulationStatusRunning SimulationStatus = "running"
	// SimulationStatusProvisioning specifies that the simulation is provisioning devices.
	SimulationStatusProvisioning SimulationStatus = "provisioning"
	// SimulationStatusDeleting specifies that the devices in the simulation are getting deleted.
	SimulationStatusDeleting SimulationStatus = "deleting"

	// DeviceDisconnectNever specifies that the device should never disconnect.
	DeviceDisconnectNever DeviceDisconnectBehavior = "never"
	// DeviceDisconnectAfterTelemetrySend specifies that the device should disconnect after sending telemetry.
	DeviceDisconnectAfterTelemetrySend DeviceDisconnectBehavior = "telemetry"

	// TelemetryFormatDefault specifies that the device sends telemetry in default JSON format.
	TelemetryFormatDefault TelemetryFormat = "default"
	// TelemetryFormatOpcua specifies that the device sends telemetry in opcua JSON format.
	TelemetryFormatOpcua TelemetryFormat = "opcua"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandType

type CommandType struct {
	ID     string
	Name   string
	IsSync bool
}

CommandType represents a command capability of a device

type Component

type Component struct {
	ComponentID   string
	ComponentType string // FIX THIS LATER!!!
	ComponentName string

	Telemetry  []*TelemetryType
	Properties []*PropertyType
	Commands   []*CommandType
}

Component represents a component in the Device Capability Model

type DeviceCapabilityModel

type DeviceCapabilityModel struct {
	Components []*Component
}

DeviceCapabilityModel represents the model of a device

type DeviceDisconnectBehavior

type DeviceDisconnectBehavior string

DeviceDisconnectBehavior defines the disconnection behavior of the simulated device.

func (*DeviceDisconnectBehavior) UnmarshalJSON

func (d *DeviceDisconnectBehavior) UnmarshalJSON(b []byte) error

UnmarshalJSON handles the un-marshalling of device disconnect behavior.

type DeviceModel

type DeviceModel struct {
	ID              string                   `json:"id"`
	Name            string                   `json:"name"`
	CapabilityModel []map[string]interface{} `json:"capabilityModel"`
}

DeviceModel is the device capability model decorated with and ID/Name to be used in simulation

func (*DeviceModel) ParseDeviceCapabilityModel

func (d *DeviceModel) ParseDeviceCapabilityModel() *DeviceCapabilityModel

ParseDeviceCapabilityModel parses the DCM from the model store

type DeviceTemplateResponse

type DeviceTemplateResponse struct {
	Value []map[string]interface{} `json:"value"`
}

DeviceTemplateResponse represents the response to deviceTemplates GET API call

type MetricsStatus

type MetricsStatus struct {
	GrafanaServer    bool `json:"grafanaServer"`
	PrometheusServer bool `json:"prometheusServer"`
}

type PropertyType

type PropertyType struct {
	ID       string
	Name     string
	Schema   string
	Writable bool
}

PropertyType represents a property capability of a device

type Simulation

type Simulation struct {
	ID                    string                   `json:"id"`                       // the id of the simulation.
	Name                  string                   `json:"name"`                     // the name of the simulation.
	TargetID              string                   `json:"targetId"`                 // the id of the target application against which the simulation is running.
	Status                SimulationStatus         `json:"status"`                   // current status of the simulation.
	WaveGroupCount        int                      `json:"waveGroupCount"`           // no. of device groups in a wave in which the total devices are distributed.
	WaveGroupInterval     int                      `json:"waveGroupInterval"`        // interval between wave groups when simulating.
	TelemetryBatchSize    int                      `json:"telemetryBatchSize"`       // batch of telemetry messages that each device will send.
	TelemetryInterval     int                      `json:"telemetryInterval"`        // interval to wait between sending telemetry messages.
	ReportedPropsInterval int                      `json:"reportedPropertyInterval"` // interval to wait between sending reported properties.
	DisconnectBehavior    DeviceDisconnectBehavior `json:"disconnectBehavior"`       // device connection behavior.
	TelemetryFormat       TelemetryFormat          `json:"telemetryFormat"`          // format of telemetry messages.
	LastUpdatedTime       time.Time                `json:"lastUpdatedTime"`          // when the status was last updated
}

Simulation definition.

type SimulationDeviceConfig

type SimulationDeviceConfig struct {
	ID          string `json:"id"`          // the id of the configuration
	ModelID     string `json:"modelId"`     // the model to simulate.
	DeviceCount int    `json:"deviceCount"` // the total no. of devices to simulate.
}

SimulationDeviceConfig defines the device configuration for a simulation.

type SimulationStatus

type SimulationStatus string

SimulationStatus specifies the current status of the simulation.

func (*SimulationStatus) UnmarshalJSON

func (status *SimulationStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON handles the un-marshalling of simulation status

type SimulationTarget

type SimulationTarget struct {
	ID              string `json:"id"`              // user supplied identifier of a target.
	Name            string `json:"name"`            // display name of the target.
	ProvisioningURL string `json:"provisioningUrl"` // DPS provisioning URL.
	IDScope         string `json:"idScope"`         // the id scope of the provisioning endpoint.
	MasterKey       string `json:"masterKey"`       // the master SAS key of the provisioning endpoint.
	AppUrl          string `json:"appUrl"`          // Central app URL
	AppToken        string `json:"appToken"`        // Central app token for API access
}

SimulationTarget specifies the target of a simulation

type SimulationTargetDevice

type SimulationTargetDevice struct {
	TargetID         string `json:"targetId"`         // identifier of a target.
	DeviceID         string `json:"deviceId"`         // device identifier in the target.
	ConnectionString string `json:"connectionString"` // IoT Hub connection string for the device.
}

SimulationTargetDevice cached copy of a device connection string in a target.

type SimulationTargetModels

type SimulationTargetModels struct {
	TargetID string   `json:"targetId"` // identifier of a target.
	Models   []string `json:"models"`   // list of model IDs available for this target.
}

SimulationTargetModels specifies the models configured for a simulation target.

type SimulationTargetType

type SimulationTargetType string

type SimulationTargetView

type SimulationTargetView struct {
	SimulationTarget      // Target application for the simulation
	ImportModels     bool `json:"importModels"` // Should models be imported when a new SimulationTarget is added
}

SimulationTargetView specifies the target to be added

type SimulationView

type SimulationView struct {
	Simulation                              // simulation configuration
	Devices    []SimulationViewDeviceConfig `json:"devices"` // devices configurations
}

type SimulationViewDeviceConfig

type SimulationViewDeviceConfig struct {
	ID               string `json:"id"`               // the id of the configuration
	ModelID          string `json:"modelId"`          // the model to simulate.
	ProvisionedCount int    `json:"provisionedCount"` // number of provisioned devices.
	SimulatedCount   int    `json:"simulatedCount"`   // number of devices to simulate.
	ConnectedCount   int    `json:"connectedCount"`   // number of devices currently connected.
}

SimulationViewDeviceConfig defines the device configuration for a simulation view.

type TelemetryFormat

type TelemetryFormat string

TelemetryFormat defines the format of the telemetry messages sent from the simulated device.

func (*TelemetryFormat) UnmarshalJSON

func (tf *TelemetryFormat) UnmarshalJSON(b []byte) error

UnmarshalJSON handles the un-marshalling of telemetry format

type TelemetryType

type TelemetryType struct {
	ID     string
	Name   string
	Schema string
}

TelemetryType represents a telemetry capability of a device

Jump to

Keyboard shortcuts

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