iotshadow

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

README

AWS Device Shadow

This activity allows you to update/get/delete a device shadow on AWS.

Installation

Flogo CLI
flogo install github.com/project-flogo/aws-contrib/activity/iotshadow

Configuration

To configure AWS credentials see configuring-sdk

Settings:
Name Type Description
thingName string The name of the "thing" in AWS IoT REQUIRED
op string The AWS IoT shadow operation to perform (Allowed values are get, update, delete) - REQUIRED
region string The AWS region, uses environment setting by default
Input:
Name Type Description
desired object The desired state of the thing
reported object The reported state of the thing
Output:
Name Type Description
result object The response shadow document

Examples

Update Temp

Configure a task in flow to update the device shadow of 'raspberry-pi' with a reported temp of "50".

{
  "id": "shadow_update",
  "name": "Update AWS Device Shadow",
  "activity": {
    "ref": "github.com/project-flogo/aws-contrib/",
    "settings": {
      "thingName": "raspberry-pi",
       "op": "update"
    },
    "input": {
      "reported": { "temp":"50" }
    }
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

Types

type Activity

type Activity struct {
	// contains filtered or unexported fields
}

Activity is an Activity that is used to update an Aws IoT device shadow settings : {thingName, op} input : {desired,reported} output : {result}

func (*Activity) Eval

func (a *Activity) Eval(context activity.Context) (done bool, err error)

Eval implements api.Activity.Eval - Invokes a Aws Iot Shadow Update

func (*Activity) Metadata

func (a *Activity) Metadata() *activity.Metadata

Metadata returns the activity's metadata

type Input

type Input struct {
	Desired  map[string]interface{} `md:"desired"`  // The desired state of the thing
	Reported map[string]interface{} `md:"reported"` // The reported state of the thing
}

func (*Input) FromMap

func (i *Input) FromMap(values map[string]interface{}) error

func (*Input) ToMap

func (i *Input) ToMap() map[string]interface{}

type Output

type Output struct {
	Result map[string]interface{} `md:"result"` // The response shadow document
}

func (*Output) FromMap

func (o *Output) FromMap(values map[string]interface{}) error

func (*Output) ToMap

func (o *Output) ToMap() map[string]interface{}

type Settings

type Settings struct {
	ThingName string `md:"thingName,required"`                     // The name of the "thing" in AWS IoT
	Op        string `md:"op,required,allowed(get,update,delete)"` // The AWS IoT shadow operation to perform
	Region    string `md:"region"`                                 // The AWS region, uses environment setting by default
}

type ShadowRequest

type ShadowRequest struct {
	State *ShadowState `json:"state"`
}

ShadowRequest is a simple structure representing a Aws Shadow Update Request

type ShadowState

type ShadowState struct {
	Desired  map[string]interface{} `json:"desired,omitempty"`
	Reported map[string]interface{} `json:"reported,omitempty"`
}

ShadowState is the state to be updated

Jump to

Keyboard shortcuts

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