2021/08/31 - AWS IoT - 6 new 1 updated api methods
Changes Added Create/Update/Delete/Describe/List APIs for a new IoT resource named FleetMetric. Added a new Fleet Indexing query API named GetBucketsAggregation. Added a new field named DisconnectedReason in Fleet Indexing query response. Updated their related documentations.
Lists all your fleet metrics.
Requires permission to access the ListFleetMetrics action.
See also: AWS API Documentation
Request Syntax
client.list_fleet_metrics( nextToken='string', maxResults=123 )
string
To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.
integer
The maximum number of results to return in this operation.
dict
Response Syntax
{ 'fleetMetrics': [ { 'metricName': 'string', 'metricArn': 'string' }, ], 'nextToken': 'string' }
Response Structure
(dict) --
fleetMetrics (list) --
The list of fleet metrics objects.
(dict) --
The name and ARN of a fleet metric.
metricName (string) --
The fleet metric name.
metricArn (string) --
The fleet metric ARN.
nextToken (string) --
The token for the next set of results. Will not be returned if the operation has returned all results.
Creates a fleet metric.
Requires permission to access the CreateFleetMetric action.
See also: AWS API Documentation
Request Syntax
client.create_fleet_metric( metricName='string', queryString='string', aggregationType={ 'name': 'Statistics'|'Percentiles'|'Cardinality', 'values': [ 'string', ] }, period=123, aggregationField='string', description='string', queryVersion='string', indexName='string', unit='Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None', tags=[ { 'Key': 'string', 'Value': 'string' }, ] )
string
[REQUIRED]
The name of the fleet metric to create.
string
[REQUIRED]
The search query string.
dict
[REQUIRED]
The type of the aggregation query.
name (string) -- [REQUIRED]
The name of the aggregation type.
values (list) --
A list of the values of aggregation types.
(string) --
integer
[REQUIRED]
The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of 60.
string
[REQUIRED]
The field to aggregate.
string
The fleet metric description.
string
The query version.
string
The name of the index to search.
string
Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW metric . Default to null.
list
Metadata, which can be used to manage the fleet metric.
(dict) --
A set of key/value pairs that are used to manage the resource.
Key (string) -- [REQUIRED]
The tag's key.
Value (string) --
The tag's value.
dict
Response Syntax
{ 'metricName': 'string', 'metricArn': 'string' }
Response Structure
(dict) --
metricName (string) --
The name of the fleet metric to create.
metricArn (string) --
The Amazon Resource Name (ARN) of the new fleet metric.
Aggregates on indexed data with search queries pertaining to particular fields.
Requires permission to access the GetBucketsAggregation action.
See also: AWS API Documentation
Request Syntax
client.get_buckets_aggregation( indexName='string', queryString='string', aggregationField='string', queryVersion='string', bucketsAggregationType={ 'termsAggregation': { 'maxBuckets': 123 } } )
string
The name of the index to search.
string
[REQUIRED]
The search query string.
string
[REQUIRED]
The aggregation field.
string
The version of the query.
dict
[REQUIRED]
The basic control of the response shape and the bucket aggregation type to perform.
termsAggregation (dict) --
Performs an aggregation that will return a list of buckets. The list of buckets is a ranked list of the number of occurrences of an aggregation field value.
maxBuckets (integer) --
The number of buckets to return in the response. Default to 10.
dict
Response Syntax
{ 'totalCount': 123, 'buckets': [ { 'keyValue': 'string', 'count': 123 }, ] }
Response Structure
(dict) --
totalCount (integer) --
The total number of documents that fit the query string criteria and contain a value for the Aggregation field targeted in the request.
buckets (list) --
The main part of the response with a list of buckets. Each bucket contains a keyValue and a count .
keyValue : The aggregation field value counted for the particular bucket.
count : The number of documents that have that value.
(dict) --
A count of documents that meets a specific aggregation criteria.
keyValue (string) --
The value counted for the particular bucket.
count (integer) --
The number of documents that have the value counted for the particular bucket.
Gets information about the specified fleet metric.
Requires permission to access the DescribeFleetMetric action.
See also: AWS API Documentation
Request Syntax
client.describe_fleet_metric( metricName='string' )
string
[REQUIRED]
The name of the fleet metric to describe.
dict
Response Syntax
{ 'metricName': 'string', 'queryString': 'string', 'aggregationType': { 'name': 'Statistics'|'Percentiles'|'Cardinality', 'values': [ 'string', ] }, 'period': 123, 'aggregationField': 'string', 'description': 'string', 'queryVersion': 'string', 'indexName': 'string', 'creationDate': datetime(2015, 1, 1), 'lastModifiedDate': datetime(2015, 1, 1), 'unit': 'Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None', 'version': 123, 'metricArn': 'string' }
Response Structure
(dict) --
metricName (string) --
The name of the fleet metric to describe.
queryString (string) --
The search query string.
aggregationType (dict) --
The type of the aggregation query.
name (string) --
The name of the aggregation type.
values (list) --
A list of the values of aggregation types.
(string) --
period (integer) --
The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of 60.
aggregationField (string) --
The field to aggregate.
description (string) --
The fleet metric description.
queryVersion (string) --
The query version.
indexName (string) --
The name of the index to search.
creationDate (datetime) --
The date when the fleet metric is created.
lastModifiedDate (datetime) --
The date when the fleet metric is last modified.
unit (string) --
Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW metric .
version (integer) --
The version of the fleet metric.
metricArn (string) --
The ARN of the fleet metric to describe.
Updates the data for a fleet metric.
Requires permission to access the UpdateFleetMetric action.
See also: AWS API Documentation
Request Syntax
client.update_fleet_metric( metricName='string', queryString='string', aggregationType={ 'name': 'Statistics'|'Percentiles'|'Cardinality', 'values': [ 'string', ] }, period=123, aggregationField='string', description='string', queryVersion='string', indexName='string', unit='Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None', expectedVersion=123 )
string
[REQUIRED]
The name of the fleet metric to update.
string
The search query string.
dict
The type of the aggregation query.
name (string) -- [REQUIRED]
The name of the aggregation type.
values (list) --
A list of the values of aggregation types.
(string) --
integer
The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of 60.
string
The field to aggregate.
string
The description of the fleet metric.
string
The version of the query.
string
[REQUIRED]
The name of the index to search.
string
Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW metric .
integer
The expected version of the fleet metric record in the registry.
None
Deletes the specified fleet metric. Returns successfully with no error if the deletion is successful or you specify a fleet metric that doesn't exist.
Requires permission to access the DeleteFleetMetric action.
See also: AWS API Documentation
Request Syntax
client.delete_fleet_metric( metricName='string', expectedVersion=123 )
string
[REQUIRED]
The name of the fleet metric to delete.
integer
The expected version of the fleet metric to delete.
None
{'things': {'connectivity': {'disconnectReason': 'string'}}}
The query search index.
Requires permission to access the SearchIndex action.
See also: AWS API Documentation
Request Syntax
client.search_index( indexName='string', queryString='string', nextToken='string', maxResults=123, queryVersion='string' )
string
The search index name.
string
[REQUIRED]
The search query string.
string
The token used to get the next set of results, or null if there are no additional results.
integer
The maximum number of results to return at one time.
string
The query version.
dict
Response Syntax
{ 'nextToken': 'string', 'things': [ { 'thingName': 'string', 'thingId': 'string', 'thingTypeName': 'string', 'thingGroupNames': [ 'string', ], 'attributes': { 'string': 'string' }, 'shadow': 'string', 'connectivity': { 'connected': True|False, 'timestamp': 123, 'disconnectReason': 'string' } }, ], 'thingGroups': [ { 'thingGroupName': 'string', 'thingGroupId': 'string', 'thingGroupDescription': 'string', 'attributes': { 'string': 'string' }, 'parentGroupNames': [ 'string', ] }, ] }
Response Structure
(dict) --
nextToken (string) --
The token used to get the next set of results, or null if there are no additional results.
things (list) --
The things that match the search query.
(dict) --
The thing search index document.
thingName (string) --
The thing name.
thingId (string) --
The thing ID.
thingTypeName (string) --
The thing type name.
thingGroupNames (list) --
Thing group names.
(string) --
attributes (dict) --
The attributes.
(string) --
(string) --
shadow (string) --
The shadow.
connectivity (dict) --
Indicates whether the thing is connected to the Amazon Web Services IoT Core service.
connected (boolean) --
True if the thing is connected to the Amazon Web Services IoT Core service; false if it is not connected.
timestamp (integer) --
The epoch time (in milliseconds) when the thing last connected or disconnected. If the thing has been disconnected for approximately an hour, the time value might be missing.
disconnectReason (string) --
The reason why the client is disconnected.
thingGroups (list) --
The thing groups that match the search query.
(dict) --
The thing group search index document.
thingGroupName (string) --
The thing group name.
thingGroupId (string) --
The thing group ID.
thingGroupDescription (string) --
The thing group description.
attributes (dict) --
The thing group attributes.
(string) --
(string) --
parentGroupNames (list) --
Parent group names.
(string) --