listPrincipalThingsV2 method
Lists the things associated with the specified principal. A principal can be an X.509 certificate or an Amazon Cognito ID.
Requires permission to access the ListPrincipalThings action.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw UnauthorizedException.
Parameter principal :
The principal. A principal can be an X.509 certificate or an Amazon
Cognito ID.
Parameter maxResults :
The maximum number of results to return in this operation.
Parameter nextToken :
To retrieve the next set of results, the nextToken value from
a previous response; otherwise null to receive the first set of
results.
Parameter thingPrincipalType :
The type of the relation you want to filter in the response. If no value
is provided in this field, the response will list all things, including
both the EXCLUSIVE_THING and NON_EXCLUSIVE_THING
attachment types.
-
EXCLUSIVE_THING- Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.
-
NON_EXCLUSIVE_THING- Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.
Implementation
Future<ListPrincipalThingsV2Response> listPrincipalThingsV2({
required String principal,
int? maxResults,
String? nextToken,
ThingPrincipalType? thingPrincipalType,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
250,
);
final headers = <String, String>{
'x-amzn-principal': principal.toString(),
};
final $query = <String, List<String>>{
if (maxResults != null) 'maxResults': [maxResults.toString()],
if (nextToken != null) 'nextToken': [nextToken],
if (thingPrincipalType != null)
'thingPrincipalType': [thingPrincipalType.value],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri: '/principals/things-v2',
queryParams: $query,
headers: headers,
exceptionFnMap: _exceptionFns,
);
return ListPrincipalThingsV2Response.fromJson(response);
}