ListRulesCommand

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { DataZoneClient, ListRulesCommand } from "@aws-sdk/client-datazone"; // ES Modules import
// const { DataZoneClient, ListRulesCommand } = require("@aws-sdk/client-datazone"); // CommonJS import
const client = new DataZoneClient(config);
const input = { // ListRulesInput
  domainIdentifier: "STRING_VALUE", // required
  targetType: "DOMAIN_UNIT", // required
  targetIdentifier: "STRING_VALUE", // required
  ruleType: "METADATA_FORM_ENFORCEMENT",
  action: "CREATE_LISTING_CHANGE_SET" || "CREATE_SUBSCRIPTION_REQUEST",
  projectIds: [ // ProjectIds
    "STRING_VALUE",
  ],
  assetTypes: [ // AssetTypeIdentifiers
    "STRING_VALUE",
  ],
  dataProduct: true || false,
  includeCascaded: true || false,
  maxResults: Number("int"),
  nextToken: "STRING_VALUE",
};
const command = new ListRulesCommand(input);
const response = await client.send(command);
// { // ListRulesOutput
//   items: [ // RuleSummaries // required
//     { // RuleSummary
//       identifier: "STRING_VALUE",
//       revision: "STRING_VALUE",
//       ruleType: "METADATA_FORM_ENFORCEMENT",
//       name: "STRING_VALUE",
//       targetType: "DOMAIN_UNIT",
//       target: { // RuleTarget Union: only one key present
//         domainUnitTarget: { // DomainUnitTarget
//           domainUnitId: "STRING_VALUE", // required
//           includeChildDomainUnits: true || false,
//         },
//       },
//       action: "CREATE_LISTING_CHANGE_SET" || "CREATE_SUBSCRIPTION_REQUEST",
//       scope: { // RuleScope
//         assetType: { // AssetTypesForRule
//           selectionMode: "ALL" || "SPECIFIC", // required
//           specificAssetTypes: [ // RuleAssetTypeList
//             "STRING_VALUE",
//           ],
//         },
//         dataProduct: true || false,
//         project: { // ProjectsForRule
//           selectionMode: "ALL" || "SPECIFIC", // required
//           specificProjects: [ // RuleProjectIdentifierList
//             "STRING_VALUE",
//           ],
//         },
//       },
//       updatedAt: new Date("TIMESTAMP"),
//       lastUpdatedBy: "STRING_VALUE",
//     },
//   ],
//   nextToken: "STRING_VALUE",
// };

ListRulesCommand Input

See ListRulesCommandInput for more details

Parameter
Type
Description
domainIdentifier
Required
string | undefined

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

targetIdentifier
Required
string | undefined

The target ID of the rule.

targetType
Required
RuleTargetType | undefined

The target type of the rule.

action
RuleAction | undefined

The action of the rule.

assetTypes
string[] | undefined

The asset types of the rule.

dataProduct
boolean | undefined

The data product of the rule.

includeCascaded
boolean | undefined

Specifies whether to include cascading rules in the results.

maxResults
number | undefined

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.

nextToken
string | undefined

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.

projectIds
string[] | undefined

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

ruleType
RuleType | undefined

The type of the rule.

ListRulesCommand Output

See ListRulesCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
items
Required
RuleSummary[] | undefined

The results of the ListRules action.

nextToken
string | undefined

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.

Throws

Name
Fault
Details
AccessDeniedException
client

You do not have sufficient access to perform this action.

InternalServerException
server

The request has failed because of an unknown error, exception or failure.

ResourceNotFoundException
client

The specified resource cannot be found.

ThrottlingException
client

The request was denied due to request throttling.

ValidationException
client

The input fails to satisfy the constraints specified by the Amazon Web Services service.

UnauthorizedException
client

You do not have permission to perform this action.

DataZoneServiceException
Base exception class for all service exceptions from DataZone service.