listPolicyPrincipals method

Future<ListPolicyPrincipalsResponse> listPolicyPrincipals({
  1. required String policyName,
  2. bool? ascendingOrder,
  3. String? marker,
  4. int? pageSize,
})

Lists the principals associated with the specified policy.

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

Requires permission to access the ListPolicyPrincipals action.

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

Parameter policyName : The policy name.

Parameter ascendingOrder : Specifies the order for results. If true, the 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<ListPolicyPrincipalsResponse> listPolicyPrincipals({
  required String policyName,
  bool? ascendingOrder,
  String? marker,
  int? pageSize,
}) async {
  _s.validateNumRange(
    'pageSize',
    pageSize,
    1,
    250,
  );
  final headers = <String, String>{
    'x-amzn-iot-policy': policyName.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: '/policy-principals',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return ListPolicyPrincipalsResponse.fromJson(response);
}