listThingPrincipals method

Future<ListThingPrincipalsResponse> listThingPrincipals({
  1. required String thingName,
  2. int? maxResults,
  3. String? nextToken,
})

Lists the principals associated with the specified thing. A principal can be X.509 certificates, IAM users, groups, and roles, Amazon Cognito identities or federated identities.

Requires permission to access the ListThingPrincipals action.

May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException.

Parameter thingName : The name of the thing.

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.

Implementation

Future<ListThingPrincipalsResponse> listThingPrincipals({
  required String thingName,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    250,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/things/${Uri.encodeComponent(thingName)}/principals',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListThingPrincipalsResponse.fromJson(response);
}