listRules method

Future<ListRulesResponse> listRules({
  1. required ResourceType resourceType,
  2. List<ResourceTag>? excludeResourceTags,
  3. LockState? lockState,
  4. int? maxResults,
  5. String? nextToken,
  6. List<ResourceTag>? resourceTags,
})

Lists the Recycle Bin retention rules in the Region.

May throw InternalServerException. May throw ValidationException.

Parameter resourceType : The resource type retained by the retention rule. Only retention rules that retain the specified resource type are listed. Currently, only EBS volumes, EBS snapshots, and EBS-backed AMIs are supported.

  • To list retention rules that retain EBS volumes, specify EBS_VOLUME.
  • To list retention rules that retain EBS snapshots, specify EBS_SNAPSHOT.
  • To list retention rules that retain EBS-backed AMIs, specify EC2_IMAGE.

Parameter excludeResourceTags : [Region-level retention rules only] Information about the exclusion tags used to identify resources that are to be excluded, or ignored, by the retention rule.

Parameter lockState : The lock state of the retention rules to list. Only retention rules with the specified lock state are returned.

Parameter maxResults : The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned NextToken value.

Parameter nextToken : The token for the next page of results.

Parameter resourceTags : [Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

Implementation

Future<ListRulesResponse> listRules({
  required ResourceType resourceType,
  List<ResourceTag>? excludeResourceTags,
  LockState? lockState,
  int? maxResults,
  String? nextToken,
  List<ResourceTag>? resourceTags,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final $payload = <String, dynamic>{
    'ResourceType': resourceType.value,
    if (excludeResourceTags != null)
      'ExcludeResourceTags': excludeResourceTags,
    if (lockState != null) 'LockState': lockState.value,
    if (maxResults != null) 'MaxResults': maxResults,
    if (nextToken != null) 'NextToken': nextToken,
    if (resourceTags != null) 'ResourceTags': resourceTags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/list-rules',
    exceptionFnMap: _exceptionFns,
  );
  return ListRulesResponse.fromJson(response);
}