forked from aws/aws-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request aws#4220 from bisdavid/iot
Several new IOT examples
- Loading branch information
Showing
8 changed files
with
234 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,17 @@ | ||
**To define a thing type** | ||
|
||
The following ``create-thing-type`` example defines a thing type and associated attributes. :: | ||
|
||
aws iot create-thing-type \ | ||
--thing-type-name "LightBulb" \ | ||
--thing-type-properties "thingTypeDescription=light bulb type, searchableAttributes=wattage,model" | ||
|
||
Output:: | ||
|
||
{ | ||
"thingTypeName": "LightBulb", | ||
"thingTypeArn": "arn:aws:iot:us-west-2:123456789012:thingtype/LightBulb", | ||
"thingTypeId": "ce3573b0-0a3c-45a7-ac93-4e0ce14cd190" | ||
} | ||
|
||
For more information, see `Thing Types <https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html>`__ in the *AWS IoT Developers Guide*. |
This file contains 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,33 @@ | ||
**Example 1: To create a thing record in the registry** | ||
|
||
The following ``create-thing`` example creates an entry for a device in the AWS IoT thing registry. :: | ||
|
||
aws iot create-thing \ | ||
--thing-name SampleIoTThing | ||
|
||
Output:: | ||
|
||
{ | ||
"thingName": "SampleIoTThing", | ||
"thingArn": "arn:aws:iot:us-west-2: 123456789012:thing/SampleIoTThing", | ||
"thingId": " EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE " | ||
} | ||
|
||
**Example 2: To define a thing that is associated with a thing type** | ||
|
||
The following ``create-thing`` example create a thing that has the specified thing type and its attributes. :: | ||
|
||
aws iot create-thing \ | ||
--thing-name "MyLightBulb" \ | ||
--thing-type-name "LightBulb" \ | ||
--attribute-payload "{"attributes": {"wattage":"75", "model":"123"}}" | ||
|
||
Output:: | ||
|
||
{ | ||
"thingName": "MyLightBulb", | ||
"thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb", | ||
"thingId": "40da2e73-c6af-406e-b415-15acae538797" | ||
} | ||
|
||
For more information, see `How to Manage Things with the Registry <https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html>`__ and `Thing Types <https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html>`__ in the *AWS IoT Developers Guide*. |
This file contains 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,9 @@ | ||
**To display detailed information about a thing** | ||
|
||
The following ``delete-thing`` example deletes a thing from the AWS IoT registry for your AWS account. | ||
|
||
aws iot delete-thing --thing-name "FourthBulb" | ||
|
||
This command produces no output. | ||
|
||
For more information, see `How to Manage Things with the Registry <https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html>`__ in the *AWS IoT Developers Guide*. |
This file contains 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,27 @@ | ||
**To get information about a thing type** | ||
|
||
The following ``describe-thing-type`` example display information about the specified thing type defined in your AWS account. :: | ||
|
||
aws iot describe-thing-type \ | ||
--thing-type-name "LightBulb" | ||
|
||
Output:: | ||
|
||
{ | ||
"thingTypeName": "LightBulb", | ||
"thingTypeId": "ce3573b0-0a3c-45a7-ac93-4e0ce14cd190", | ||
"thingTypeArn": "arn:aws:iot:us-west-2:123456789012:thingtype/LightBulb", | ||
"thingTypeProperties": { | ||
"thingTypeDescription": "light bulb type", | ||
"searchableAttributes": [ | ||
"model", | ||
"wattage" | ||
] | ||
}, | ||
"thingTypeMetadata": { | ||
"deprecated": false, | ||
"creationDate": 1559772562.498 | ||
} | ||
} | ||
|
||
For more information, see `Thing Types <https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html>`__ in the *AWS IoT Developers Guide*. |
This file contains 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,23 @@ | ||
**To display detailed information about a thing** | ||
|
||
The following ``describe-thing`` example display information about a thing (device) that is defined in the AWS IoT registry for your AWS account. | ||
|
||
aws iot describe-thing \ | ||
--thing-name "MyLightBulb" | ||
|
||
Output:: | ||
|
||
{ | ||
"defaultClientId": "MyLightBulb", | ||
"thingName": "MyLightBulb", | ||
"thingId": "40da2e73-c6af-406e-b415-15acae538797", | ||
"thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb", | ||
"thingTypeName": "LightBulb", | ||
"attributes": { | ||
"model": "123", | ||
"wattage": "75" | ||
}, | ||
"version": 1 | ||
} | ||
|
||
For more information, see `How to Manage Things with the Registry <https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html>`__ in the *AWS IoT Developers Guide*. |
This file contains 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,29 @@ | ||
**To list the defined thing types** | ||
|
||
The following ``list-thing-types`` example displays a list of thing types defined in your AWS account. :: | ||
|
||
aws iot list-thing-types | ||
|
||
Output:: | ||
|
||
{ | ||
"thingTypes": [ | ||
{ | ||
"thingTypeName": "LightBulb", | ||
"thingTypeArn": "arn:aws:iot:us-west-2:123456789012:thingtype/LightBulb", | ||
"thingTypeProperties": { | ||
"thingTypeDescription": "light bulb type", | ||
"searchableAttributes": [ | ||
"model", | ||
"wattage" | ||
] | ||
}, | ||
"thingTypeMetadata": { | ||
"deprecated": false, | ||
"creationDate": 1559772562.498 | ||
} | ||
} | ||
] | ||
} | ||
|
||
For more information, see `Thing Types <https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html>`__ in the *AWS IoT Developers Guide*. |
This file contains 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 @@ | ||
**Example 1: To list all things in the registry** | ||
|
||
The following ``list-things`` example lists the things (devices) that are defined in the AWS IoT registry for your AWS account. :: | ||
|
||
aws iot list-things | ||
|
||
Output:: | ||
|
||
{ | ||
"things": [ | ||
{ | ||
"thingName": "ThirdBulb", | ||
"thingTypeName": "LightBulb", | ||
"thingArn": "arn:aws:iot:us-west-2:123456789012:thing/ThirdBulb", | ||
"attributes": { | ||
"model": "123", | ||
"wattage": "75" | ||
}, | ||
"version": 2 | ||
}, | ||
{ | ||
"thingName": "MyOtherLightBulb", | ||
"thingTypeName": "LightBulb", | ||
"thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyOtherLightBulb", | ||
"attributes": { | ||
"model": "123", | ||
"wattage": "75" | ||
}, | ||
"version": 3 | ||
}, | ||
{ | ||
"thingName": "MyLightBulb", | ||
"thingTypeName": "LightBulb", | ||
"thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb", | ||
"attributes": { | ||
"model": "123", | ||
"wattage": "75" | ||
}, | ||
"version": 1 | ||
}, | ||
{ | ||
"thingName": "SampleIoTThing", | ||
"thingArn": "arn:aws:iot:us-west-2:123456789012:thing/SampleIoTThing", | ||
"attributes": {}, | ||
"version": 1 | ||
} | ||
] | ||
} | ||
|
||
**Example 2: To list the defined things that have a specific attribute** | ||
|
||
The following ``list-things`` example displays a list of things that have an attribute named ``wattage``. :: | ||
|
||
aws iot list-things \ | ||
--attribute-name wattage | ||
|
||
Output:: | ||
|
||
{ | ||
"things": [ | ||
{ | ||
"thingName": "MyLightBulb", | ||
"thingTypeName": "LightBulb", | ||
"thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb", | ||
"attributes": { | ||
"model": "123", | ||
"wattage": "75" | ||
}, | ||
"version": 1 | ||
}, | ||
{ | ||
"thingName": "MyOtherLightBulb", | ||
"thingTypeName": "LightBulb", | ||
"thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyOtherLightBulb", | ||
"attributes": { | ||
"model": "123", | ||
"wattage": "75" | ||
}, | ||
"version": 3 | ||
} | ||
] | ||
} | ||
|
||
For more information, see `How to Manage Things with the Registry <https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html>`__ in the *AWS IoT Developers Guide*. |
This file contains 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,12 @@ | ||
**To associate a thing with a thing type** | ||
|
||
The following ``update-thing`` example associates a thing in the AWS IoT registry with a thing type. When you make the association, you provide values for the attributes defined by the thing type. :: | ||
|
||
aws iot update-thing \ | ||
--thing-name "MyOtherLightBulb" \ | ||
--thing-type-name "LightBulb" \ | ||
--attribute-payload "{"attributes": {"wattage":"75", "model":"123"}}" | ||
|
||
This command does not produce output. Use the ``describe-thing`` command to see the result. | ||
|
||
For more information, see `Thing Types <https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html>`__ in the *AWS IoT Developers Guide*. |