iotcore

package
v0.0.0-...-4a3d6f3 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeviceNotFound            = errors.New("device not found")
	ErrDeviceIncosistent         = errors.New("device is not consistent")
	ErrThingPrincipalNotDetached = errors.New(
		"giving up on waiting for Thing principal being detached")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	GetDeviceShadow(ctx context.Context, creds model.AWSCredentials, id string) (*DeviceShadow, error)
	UpdateDeviceShadow(
		ctx context.Context,
		creds model.AWSCredentials,
		deviceID string,
		update DeviceShadowUpdate,
	) (*DeviceShadow, error)
	GetDevice(ctx context.Context, creds model.AWSCredentials, deviceID string) (*Device, error)
	UpsertDevice(ctx context.Context, creds model.AWSCredentials, deviceID string, device *Device, policy string) (*Device, error)
	DeleteDevice(ctx context.Context, creds model.AWSCredentials, deviceID string) error
}

func NewClient

func NewClient() Client

type DesiredState

type DesiredState struct {
	Desired map[string]interface{} `json:"desired"`
}

type Device

type Device struct {
	ID            string  `json:"id"`
	Name          string  `json:"name"`
	Version       int64   `json:"version,omitempty"`
	Status        Status  `json:"status,omitempty"`
	CertificateID string  `json:"certificate_id,omitempty"`
	Certificate   string  `json:"certificate,omitempty"`
	PrivateKey    string  `json:"private_key,omitempty"`
	Endpoint      *string `json:"endpoint,omitempty"`
}

type DeviceShadow

type DeviceShadow struct {
	Payload model.DeviceState `json:"state"`
}

type DeviceShadowUpdate

type DeviceShadowUpdate struct {
	State DesiredState `json:"state"`
}

type Status

type Status string
const (
	StatusEnabled  Status = "enabled"
	StatusDisabled Status = "disabled"
)

func NewStatusFromMenderStatus

func NewStatusFromMenderStatus(status model.Status) Status

func (*Status) UnmarshalText

func (s *Status) UnmarshalText(b []byte) error

func (Status) Validate

func (s Status) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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