Skip to main content

thing_groups

Creates, updates, deletes or gets a thing_group resource or lists thing_groups in a region

Overview

Namething_groups
TypeResource
DescriptionResource Type definition for AWS::IoT::ThingGroup
Idawscc.iot.thing_groups

Fields

NameDatatypeDescription
idstring
arnstring
thing_group_namestring
parent_group_namestring
query_stringstring
thing_group_propertiesobject
tagsarrayAn array of key-value pairs to apply to this resource.
regionstringAWS region.

For more information, see AWS::IoT::ThingGroup.

Methods

NameResourceAccessible byRequired Params
create_resourcething_groupsINSERTregion
delete_resourcething_groupsDELETEIdentifier, region
update_resourcething_groupsUPDATEIdentifier, PatchDocument, region
list_resourcesthing_groups_list_onlySELECTregion
get_resourcething_groupsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual thing_group.

SELECT
region,
id,
arn,
thing_group_name,
parent_group_name,
query_string,
thing_group_properties,
tags
FROM awscc.iot.thing_groups
WHERE
region = '{{ region }}' AND
Identifier = '{{ thing_group_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new thing_group resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.iot.thing_groups (
ThingGroupName,
ParentGroupName,
QueryString,
ThingGroupProperties,
Tags,
region
)
SELECT
'{{ thing_group_name }}',
'{{ parent_group_name }}',
'{{ query_string }}',
'{{ thing_group_properties }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a thing_group resource, using stack-deploy.

/*+ update */
UPDATE awscc.iot.thing_groups
SET PatchDocument = string('{{ {
"QueryString": query_string,
"ThingGroupProperties": thing_group_properties,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ thing_group_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.iot.thing_groups
WHERE
Identifier = '{{ thing_group_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the thing_groups resource, the following permissions are required:

iot:DescribeThingGroup,
iot:ListTagsForResource,
iot:CreateThingGroup,
iot:CreateDynamicThingGroup,
iot:TagResource