listPrincipalThings method

Future<ListPrincipalThingsResponse> listPrincipalThings({
  1. required String principal,
  2. int? maxResults,
  3. String? nextToken,
})

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

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

Parameter principal : The principal.

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<ListPrincipalThingsResponse> listPrincipalThings({
  required String principal,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(principal, 'principal');
  _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],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/principals/things',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return ListPrincipalThingsResponse.fromJson(response);
}