From 7fe6f1a672705bafe5e17b97d778270ca50c4ba9 Mon Sep 17 00:00:00 2001 From: Dave Bishop Date: Thu, 6 Jun 2019 12:34:22 -0700 Subject: [PATCH] Several new IOT examples --- awscli/examples/iot/create-thing-type.rst | 17 +++++ awscli/examples/iot/create-thing.rst | 33 ++++++++ awscli/examples/iot/delete-thing.rst | 9 +++ awscli/examples/iot/describe-thing-type.rst | 27 +++++++ awscli/examples/iot/describe-thing.rst | 23 ++++++ awscli/examples/iot/list-thing-types.rst | 29 +++++++ awscli/examples/iot/list-things.rst | 84 +++++++++++++++++++++ awscli/examples/iot/update-thing.rst | 12 +++ 8 files changed, 234 insertions(+) create mode 100644 awscli/examples/iot/create-thing-type.rst create mode 100644 awscli/examples/iot/create-thing.rst create mode 100644 awscli/examples/iot/delete-thing.rst create mode 100644 awscli/examples/iot/describe-thing-type.rst create mode 100644 awscli/examples/iot/describe-thing.rst create mode 100644 awscli/examples/iot/list-thing-types.rst create mode 100644 awscli/examples/iot/list-things.rst create mode 100644 awscli/examples/iot/update-thing.rst diff --git a/awscli/examples/iot/create-thing-type.rst b/awscli/examples/iot/create-thing-type.rst new file mode 100644 index 000000000000..4a644d732d2f --- /dev/null +++ b/awscli/examples/iot/create-thing-type.rst @@ -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 `__ in the *AWS IoT Developers Guide*. diff --git a/awscli/examples/iot/create-thing.rst b/awscli/examples/iot/create-thing.rst new file mode 100644 index 000000000000..4469bf1045e7 --- /dev/null +++ b/awscli/examples/iot/create-thing.rst @@ -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 `__ and `Thing Types `__ in the *AWS IoT Developers Guide*. diff --git a/awscli/examples/iot/delete-thing.rst b/awscli/examples/iot/delete-thing.rst new file mode 100644 index 000000000000..04668cd1ae92 --- /dev/null +++ b/awscli/examples/iot/delete-thing.rst @@ -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 `__ in the *AWS IoT Developers Guide*. diff --git a/awscli/examples/iot/describe-thing-type.rst b/awscli/examples/iot/describe-thing-type.rst new file mode 100644 index 000000000000..4f429c46385a --- /dev/null +++ b/awscli/examples/iot/describe-thing-type.rst @@ -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 `__ in the *AWS IoT Developers Guide*. diff --git a/awscli/examples/iot/describe-thing.rst b/awscli/examples/iot/describe-thing.rst new file mode 100644 index 000000000000..2fa247c1934e --- /dev/null +++ b/awscli/examples/iot/describe-thing.rst @@ -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 `__ in the *AWS IoT Developers Guide*. diff --git a/awscli/examples/iot/list-thing-types.rst b/awscli/examples/iot/list-thing-types.rst new file mode 100644 index 000000000000..5cb2299ce844 --- /dev/null +++ b/awscli/examples/iot/list-thing-types.rst @@ -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 `__ in the *AWS IoT Developers Guide*. diff --git a/awscli/examples/iot/list-things.rst b/awscli/examples/iot/list-things.rst new file mode 100644 index 000000000000..4a62e0480e98 --- /dev/null +++ b/awscli/examples/iot/list-things.rst @@ -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 `__ in the *AWS IoT Developers Guide*. diff --git a/awscli/examples/iot/update-thing.rst b/awscli/examples/iot/update-thing.rst new file mode 100644 index 000000000000..085e334df71b --- /dev/null +++ b/awscli/examples/iot/update-thing.rst @@ -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 `__ in the *AWS IoT Developers Guide*.