Documentation
¶
Index ¶
- Constants
- type KeyPair
- type Payload
- type Shadow
- type ShadowError
- type Thing
- func (t *Thing) DeleteThingShadow() error
- func (t *Thing) Disconnect()
- func (t *Thing) GetNextJob() (Payload, error)
- func (t *Thing) GetThingShadow() (Shadow, error)
- func (t *Thing) ListenForJobs() (chan Payload, error)
- func (t *Thing) PublishToCustomTopic(payload Payload, topic string) error
- func (t *Thing) SubscribeForCustomTopic(topic string) (chan Payload, error)
- func (t *Thing) SubscribeForThingShadowChanges() (chan Shadow, chan ShadowError, error)
- func (t Thing) UnsubscribeFromCustomTopic(topic string) error
- func (t *Thing) UnsubscribeFromJobs() error
- func (t *Thing) UpdateThingShadow(payload Shadow) error
- func (t *Thing) UpdateThingShadowDocument(payload Shadow) error
- type ThingName
Constants ¶
const ROOT_PEM = `` /* 1187-byte string literal not displayed */
Amazon Root CA for IoT Core - Subject to change (but likely not often) https://www.amazontrust.com/repository/AmazonRootCA1.pem
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ShadowError ¶
type ShadowError = Shadow
ShadowError represents the model for handling the errors occurred during updating the device shadow
type Thing ¶
type Thing struct {
// contains filtered or unexported fields
}
Thing a structure for working with the AWS IoT device shadows
func NewThingFromFiles ¶
NewThingFromFiles returns a new instance of Thing
func NewThingFromStrings ¶
func NewThingFromStrings(cert string, key string, awsEndpoint string, thingName ThingName) (*Thing, error)
NewThingFromStrings returns a new instance of Thing
func (*Thing) DeleteThingShadow ¶
DeleteThingShadow publishes a message to remove the device's shadow and waits for the result. In case shadow delete was rejected the method will return error
func (*Thing) Disconnect ¶
func (t *Thing) Disconnect()
Disconnect terminates the MQTT connection between the client and the AWS server. Recommended to use in defer to avoid connection leaks.
func (*Thing) GetNextJob ¶
func (*Thing) GetThingShadow ¶
GetThingShadow returns the current thing shadow
func (*Thing) ListenForJobs ¶
ListenForJobs is a helper function that subscribes to the topic responsible for notifying on IoT Core Jobs
func (*Thing) PublishToCustomTopic ¶
PublishToCustomTopic publishes an async message to the custom topic.
func (*Thing) SubscribeForCustomTopic ¶
SubscribeForCustomTopic subscribes for the custom topic and returns the channel with the topic messages.
func (*Thing) SubscribeForThingShadowChanges ¶
func (t *Thing) SubscribeForThingShadowChanges() (chan Shadow, chan ShadowError, error)
SubscribeForThingShadowChanges subscribes for the device shadow update topic and returns two channels: shadow and shadow error. The shadow channel will handle all accepted device shadow updates. The shadow error channel will handle all rejected device shadow updates
func (Thing) UnsubscribeFromCustomTopic ¶
UnsubscribeFromCustomTopic terminates the subscription to the custom topic. The specified topic argument will be prepended by a prefix "$aws/things/<thing_name>"
func (*Thing) UnsubscribeFromJobs ¶
func (*Thing) UpdateThingShadow ¶
UpdateThingShadow publishes an async message with new thing shadow
func (*Thing) UpdateThingShadowDocument ¶
UpdateThingShadowDocument publishes an async message with new thing shadow document