createRule method
Creates a rule 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 ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter action :
The action of the rule.
Parameter detail :
The detail of the rule.
Parameter domainIdentifier :
The ID of the domain where the rule is created.
Parameter name :
The name of the rule.
Parameter scope :
The scope of the rule.
Parameter target :
The target of the rule.
Parameter clientToken :
A unique, case-sensitive identifier that is provided to ensure the
idempotency of the request.
Parameter description :
The description of the rule.
Implementation
Future<CreateRuleOutput> createRule({
required RuleAction action,
required RuleDetail detail,
required String domainIdentifier,
required String name,
required RuleScope scope,
required RuleTarget target,
String? clientToken,
String? description,
}) async {
final $payload = <String, dynamic>{
'action': action.value,
'detail': detail,
'name': name,
'scope': scope,
'target': target,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v2/domains/${Uri.encodeComponent(domainIdentifier)}/rules',
exceptionFnMap: _exceptionFns,
);
return CreateRuleOutput.fromJson(response);
}