listPrincipalPolicies method

Future<ListPrincipalPoliciesResponse> listPrincipalPolicies({
  1. required String principal,
  2. bool? ascendingOrder,
  3. String? marker,
  4. int? pageSize,
})

Lists the policies attached to the specified principal. If you use an Cognito identity, the ID must be in AmazonCognito Identity format.

Note: This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use ListAttachedPolicies instead.

Requires permission to access the ListPrincipalPolicies action.

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

Parameter principal : The principal. Valid principals are CertificateArn (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId (region:id).

Parameter ascendingOrder : Specifies the order for results. If true, results are returned in ascending creation order.

Parameter marker : The marker for the next set of results.

Parameter pageSize : The result page size.

Implementation

Future<ListPrincipalPoliciesResponse> listPrincipalPolicies({
  required String principal,
  bool? ascendingOrder,
  String? marker,
  int? pageSize,
}) async {
  _s.validateNumRange(
    'pageSize',
    pageSize,
    1,
    250,
  );
  final headers = <String, String>{
    'x-amzn-iot-principal': principal.toString(),
  };
  final $query = <String, List<String>>{
    if (ascendingOrder != null)
      'isAscendingOrder': [ascendingOrder.toString()],
    if (marker != null) 'marker': [marker],
    if (pageSize != null) 'pageSize': [pageSize.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/principal-policies',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return ListPrincipalPoliciesResponse.fromJson(response);
}