aws-iot-device-lib

module
v0.0.0-...-8a984d7 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: Apache-2.0

README

AWS IoT Device Lib

This Go library is for use on the device side of AWS IoT, built on top of the Paho MQTT library.

Note: This library is NOT official AWS.

Currently implemented API.

  • AWS IoT Jobs

Go 1.18 or later version is required because of generics.

AWS IoT Jobs

The API is implemented according to AWS IoT Jobs device MQTT API.

example: DescribeJobExecution

Here is an example. For examples of other APIs, see the directory under examples/jobs.

// Here `mc` is a Paho mqtt.client that has already been set up.

client, err := jobs.NewClient(mc) // setup jobs.Client based on mqtt.Client
if err != nil {
	return err
}

// Create a request
req := DescribeJobExecutionInput{
	ThingName: aws.String("thing-1234"),
	JobId:     aws.String("test-job"),
}

// Calls a method as synchronous execution.
ret, err := client.DescribeJobExecution(context.Background(), req)
if err != nil {
    // If rejected, error will be returned.
	return err
}
// Now you get
for _, step := range ret.Execution.JobDocument.Steps {
	fmt.Printf("Steps: %s\n", step.Action.Name)
}

License

Apache License 2.0

Some of codes are BSD-3-Clause beceause those are copied from Go code.

Directories

Path Synopsis
examples
connect
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
jobs
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
internal
mqttutils
SPDX-License-Identifier: BSD-3-Clause Copyright 2022 The Go Authors.
SPDX-License-Identifier: BSD-3-Clause Copyright 2022 The Go Authors.
These contents are copied and slightly modified from aws-sdk-go-v2 https://github.com/aws/aws-sdk-go-v2/tree/main/service/iotjobsdataplane SPDX-License-Identifier: Apache-2.0
These contents are copied and slightly modified from aws-sdk-go-v2 https://github.com/aws/aws-sdk-go-v2/tree/main/service/iotjobsdataplane SPDX-License-Identifier: Apache-2.0

Jump to

Keyboard shortcuts

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