addPolicyGrant method
Adds a policy grant (an authorization policy) to a specified entity, including domain units, environment blueprint configurations, or environment profiles.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter detail :
The details of the policy grant.
Parameter domainIdentifier :
The ID of the domain where you want to add a policy grant.
Parameter entityIdentifier :
The ID of the entity (resource) to which you want to add a policy grant.
Parameter entityType :
The type of entity (resource) to which the grant is added.
Parameter policyType :
The type of policy that you want to grant.
Parameter principal :
The principal to whom the permissions are granted.
Parameter clientToken :
A unique, case-sensitive identifier that is provided to ensure the
idempotency of the request.
Implementation
Future<AddPolicyGrantOutput> addPolicyGrant({
required PolicyGrantDetail detail,
required String domainIdentifier,
required String entityIdentifier,
required TargetEntityType entityType,
required ManagedPolicyType policyType,
required PolicyGrantPrincipal principal,
String? clientToken,
}) async {
final $payload = <String, dynamic>{
'detail': detail,
'policyType': policyType.value,
'principal': principal,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/v2/domains/${Uri.encodeComponent(domainIdentifier)}/policies/managed/${Uri.encodeComponent(entityType.value)}/${Uri.encodeComponent(entityIdentifier)}/addGrant',
exceptionFnMap: _exceptionFns,
);
return AddPolicyGrantOutput.fromJson(response);
}