listRules method

Future<ListRulesOutput> listRules({
  1. required String domainIdentifier,
  2. required String targetIdentifier,
  3. required RuleTargetType targetType,
  4. RuleAction? action,
  5. List<String>? assetTypes,
  6. bool? dataProduct,
  7. bool? includeCascaded,
  8. int? maxResults,
  9. String? nextToken,
  10. List<String>? projectIds,
  11. RuleType? ruleType,
})

Lists existing rules. In Amazon DataZone, a rule is a formal agreement that enforces specific requirements across user workflows (e.g., publishing assets to the catalog, requesting subscriptions, creating projects) within the Amazon DataZone data portal. These rules help maintain consistency, ensure compliance, and uphold governance standards in data management processes. For instance, a metadata enforcement rule can specify the required information for creating a subscription request or publishing a data asset to the catalog, ensuring alignment with organizational standards.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter domainIdentifier : The ID of the domain in which the rules are to be listed.

Parameter targetIdentifier : The target ID of the rule.

Parameter targetType : The target type of the rule.

Parameter action : The action of the rule.

Parameter assetTypes : The asset types of the rule.

Parameter dataProduct : The data product of the rule.

Parameter includeCascaded : Specifies whether to include cascading rules in the results.

Parameter maxResults : The maximum number of rules to return in a single call to ListRules. When the number of rules to be listed is greater than the value of MaxResults, the response contains a NextToken value that you can use in a subsequent call to ListRules to list the next set of rules.

Parameter nextToken : When the number of rules is greater than the default value for the MaxResults parameter, or if you explicitly specify a value for MaxResults that is less than the number of rules, the response includes a pagination token named NextToken. You can specify this NextToken value in a subsequent call to ListRules to list the next set of rules.

Parameter projectIds : The IDs of projects in which rules are to be listed.

Parameter ruleType : The type of the rule.

Implementation

Future<ListRulesOutput> listRules({
  required String domainIdentifier,
  required String targetIdentifier,
  required RuleTargetType targetType,
  RuleAction? action,
  List<String>? assetTypes,
  bool? dataProduct,
  bool? includeCascaded,
  int? maxResults,
  String? nextToken,
  List<String>? projectIds,
  RuleType? ruleType,
}) async {
  final $query = <String, List<String>>{
    if (action != null) 'ruleAction': [action.value],
    if (assetTypes != null) 'assetTypes': assetTypes,
    if (dataProduct != null) 'dataProduct': [dataProduct.toString()],
    if (includeCascaded != null)
      'includeCascaded': [includeCascaded.toString()],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (projectIds != null) 'projectIds': projectIds,
    if (ruleType != null) 'ruleType': [ruleType.value],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/v2/domains/${Uri.encodeComponent(domainIdentifier)}/list-rules/${Uri.encodeComponent(targetType.value)}/${Uri.encodeComponent(targetIdentifier)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListRulesOutput.fromJson(response);
}