listAttachedPolicies method

Future<ListAttachedPoliciesResponse> listAttachedPolicies({
  1. required String target,
  2. String? marker,
  3. int? pageSize,
  4. bool? recursive,
})

Lists the policies attached to the specified thing group.

Requires permission to access the ListAttachedPolicies action.

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

Parameter target : The group or principal for which the policies will be listed. Valid principals are CertificateArn (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId (region:id).

Parameter marker : The token to retrieve the next set of results.

Parameter pageSize : The maximum number of results to be returned per request.

Parameter recursive : When true, recursively list attached policies.

Implementation

Future<ListAttachedPoliciesResponse> listAttachedPolicies({
  required String target,
  String? marker,
  int? pageSize,
  bool? recursive,
}) async {
  _s.validateNumRange(
    'pageSize',
    pageSize,
    1,
    250,
  );
  final $query = <String, List<String>>{
    if (marker != null) 'marker': [marker],
    if (pageSize != null) 'pageSize': [pageSize.toString()],
    if (recursive != null) 'recursive': [recursive.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'POST',
    requestUri: '/attached-policies/${Uri.encodeComponent(target)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListAttachedPoliciesResponse.fromJson(response);
}