awsiot

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0

README

tibco-awsiot

This activity provides your flogo application the ability to update a device shadow on Aws.

Installation

flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/awsiot

Schema

Inputs and Outputs:

{
  "inputs":[
    {
      "name": "thingName",
      "type": "string",
      "required": true
    },
    {
      "name": "awsEndpoint",
      "type": "string",
      "required": true
    },
    {
      "name": "desired",
      "type": "params"
    },
    {
      "name": "reported",
      "type": "params"
    }
  ]
}

Settings

Setting Description
thingName The name of the "thing" in Aws IoT
awsEndpoint The Aws Iot Endpoint for the account
desired The desired state to update
reported The reported state to update

Configuration

Certificate Installation

The activity looks for the Aws device certificates in a "things" directory relative to where the engine was started. Download the root CA certificate file and save it as "things/root-CA.pem.crt". Now place the cert and private key generated by Aws IoT for your thing under "things/[thingName]" as device.pem.crt and device.pem.key respectively.

Flow Configuration

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

{
  "id": 3,
  "type": 1,
  "activityType": "tibco-awsiot",
  "name": "Update Device Shadow",
  "attributes": [
    {
      "name": "thingName",
      "type": "string",
      "value": "raspberry-pi"
    },
    {
      "name": "awsEndpoint",
      "type": "string",
      "value": "A3CWMRYOWXFD7I.iot.us-west-2.amazonaws.com"
    },
    {
      "name": "reported",
      "type": "params",
      "value": { "temp":"50" }
    }
  ]
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewActivity

func NewActivity(metadata *activity.Metadata) activity.Activity

NewActivity creates a new AwsIoT activity

func NewTLSConfig

func NewTLSConfig(thingName string) *tls.Config

NewTLSConfig creates a TLS configuration for the specified 'thing'

func Publish

func Publish(client MQTT.Client, topic string, qos int, input string) error

Publish publishes a client message

Types

type AwsIoT

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

AwsIoT is an Activity that is used to update an Aws IoT device shadow inputs : {method,uri,params} outputs: {result}

func (*AwsIoT) Eval

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

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

func (*AwsIoT) Metadata

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

Metadata returns the activity's metadata

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]string `json:"desired,omitempty"`
	Reported map[string]string `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