- Notifications
You must be signed in to change notification settings - Fork 220
Request-response MQTT service clients #619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
28 commits Select commit Hold shift + click to select a range
54775cc Checkpoint pre-codegen
8f8d16a Checkpoint
d0ca844 Identity testing part1
b9b6f98 CSR signing
217ff49 Updated jobs module
9f18d59 Jobs framework
bretambrose defefac Jobs processing tests
cd10937 V2 shadow sample and usage guide
6d830d7 Jobs sandbox and readme
88e4ed7 Update deprecated file path
a9d5ebb Fleet provisioning samples
bretambrose 3ecc3ea CRT version
f0b652c Merge branch 'main' into RequestResponseWorkspace
6d57f6f Start working on CI
13f910f Sample paths updated
baeb473 Sphinx updates
e2b59a7 Try to run service tests on linux
86683e7 Stop using builder
0613bee Hybrid approach to service testing
eb92866 Paths
8b5c050 Service tests in mac and windows too
e35d2b5 Workaround
d75c96d Different utils path
06dcf11 Dirty hack for utils module
30197fb Merge branch 'main' into RequestResponseWorkspace2
e74f226 Oops
6e288cf Sphinx and generic type hints don't work together well
ca4f6b1 Documentation updates
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Jobs sandbox and readme
- Loading branch information
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # Jobs | ||
| | ||
| [**Return to main sample list**](./README.md) | ||
| | ||
| This sample uses the AWS IoT [Jobs](https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html) Service to describe jobs to execute. [Jobs](https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html) is a service that allows you to define and respond to remote operation requests defined through the AWS IoT Core website or via any other device (or CLI command) that can access the [Jobs](https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html) service. | ||
| | ||
| Note: This sample requires you to create jobs for your device to execute. See | ||
| [instructions here](https://docs.aws.amazon.com/iot/latest/developerguide/create-manage-jobs.html) for how to make jobs. | ||
| | ||
| On startup, the sample describes the jobs that are pending execution and pretends to process them, marking each job as complete as it does so. | ||
| | ||
| Your IoT Core Thing's [Policy](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html) must provide privileges for this sample to connect, subscribe, publish, and receive. Below is a sample policy that can be used on your IoT Core Thing that will allow this sample to run as intended. | ||
| | ||
| <details> | ||
| <summary>Sample Policy</summary> | ||
| <pre> | ||
| { | ||
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
| { | ||
| "Effect": "Allow", | ||
| "Action": "iot:Publish", | ||
| "Resource": [ | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/things/<b>thingname</b>/jobs/start-next", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/things/<b>thingname</b>/jobs/*/update", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/things/<b>thingname</b>/jobs/*/get", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/things/<b>thingname</b>/jobs/get" | ||
| ] | ||
| }, | ||
| { | ||
| "Effect": "Allow", | ||
| "Action": "iot:Receive", | ||
| "Resource": [ | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/things/<b>thingname</b>/jobs/notify-next", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/things/<b>thingname</b>/jobs/start-next/*", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/things/<b>thingname</b>/jobs/*/update/*", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/things/<b>thingname</b>/jobs/get/*", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topic/$aws/things/<b>thingname</b>/jobs/*/get/*" | ||
| ] | ||
| }, | ||
| { | ||
| "Effect": "Allow", | ||
| "Action": "iot:Subscribe", | ||
| "Resource": [ | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topicfilter/$aws/things/<b>thingname</b>/jobs/notify-next", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topicfilter/$aws/things/<b>thingname</b>/jobs/start-next/*", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topicfilter/$aws/things/<b>thingname</b>/jobs/*/update/*", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topicfilter/$aws/things/<b>thingname</b>/jobs/get/*", | ||
| "arn:aws:iot:<b>region</b>:<b>account</b>:topicfilter/$aws/things/<b>thingname</b>/jobs/*/get/*" | ||
| ] | ||
| }, | ||
| { | ||
| "Effect": "Allow", | ||
| "Action": "iot:Connect", | ||
| "Resource": "arn:aws:iot:<b>region</b>:<b>account</b>:client/test-*" | ||
| } | ||
| ] | ||
| } | ||
| </pre> | ||
| | ||
| Replace with the following with the data from your AWS account: | ||
| * `<region>`: The AWS IoT Core region where you created your AWS IoT Core thing you wish to use with this sample. For example `us-east-1`. | ||
| * `<account>`: Your AWS IoT Core account ID. This is the set of numbers in the top right next to your AWS account name when using the AWS IoT Core website. | ||
| * `<thingname>`: The name of your AWS IoT Core thing you want the device connection to be associated with | ||
| | ||
| Note that in a real application, you may want to avoid the use of wildcards in your ClientID or use them selectively. Please follow best practices when working with AWS on production applications using the SDK. Also, for the purposes of this sample, please make sure your policy allows a client ID of `test-*` to connect or use `--client_id <client ID here>` to send the client ID your policy supports. | ||
| | ||
| </details> | ||
| | ||
| ## How to run | ||
| | ||
| Use the following command to run the Jobs sample from the `samples` folder: | ||
| | ||
| ``` sh | ||
| # For Windows: replace 'python3' with 'python' and '/' with '\' | ||
| python3 jobs.py --endpoint <endpoint> --cert <file> --key <file> --thing_name <name> | ||
| ``` | ||
| | ||
| You can also pass a Certificate Authority file (CA) if your certificate and key combination requires it: | ||
| | ||
| ``` sh | ||
| # For Windows: replace 'python3' with 'python' and '/' with '\' | ||
| python3 jobs.py --endpoint <endpoint> --cert <file> --key <file> --thing_name <name> --ca_file <file> | ||
| ``` | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trivial: May not be worthwhile but maybe we could add a comment at the start of the deprecated sample .md files that state this sample is deprecated with a link to the current service client outside of the deprecated folder. Might not be worth the trouble though since to see this, someone would have to come looking specifically in the deprecated folder....
On a side note, should we simply remove these from existence since they're just samples that we don't want anyone using?