removePolicyGrant method

Future<void> removePolicyGrant({
  1. required String domainIdentifier,
  2. required String entityIdentifier,
  3. required TargetEntityType entityType,
  4. required ManagedPolicyType policyType,
  5. required PolicyGrantPrincipal principal,
  6. String? clientToken,
  7. String? grantIdentifier,
})

Removes a policy grant.

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

Parameter domainIdentifier : The ID of the domain where you want to remove a policy grant.

Parameter entityIdentifier : The ID of the entity from which you want to remove a policy grant.

Parameter entityType : The type of the entity from which you want to remove a policy grant.

Parameter policyType : The type of the policy that you want to remove.

Parameter principal : The principal from which you want to remove a policy grant.

Parameter clientToken : A unique, case-sensitive identifier that is provided to ensure the idempotency of the request.

Parameter grantIdentifier : The ID of the policy grant that is to be removed from a specified entity.

Implementation

Future<void> removePolicyGrant({
  required String domainIdentifier,
  required String entityIdentifier,
  required TargetEntityType entityType,
  required ManagedPolicyType policyType,
  required PolicyGrantPrincipal principal,
  String? clientToken,
  String? grantIdentifier,
}) async {
  final $payload = <String, dynamic>{
    'policyType': policyType.value,
    'principal': principal,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (grantIdentifier != null) 'grantIdentifier': grantIdentifier,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v2/domains/${Uri.encodeComponent(domainIdentifier)}/policies/managed/${Uri.encodeComponent(entityType.value)}/${Uri.encodeComponent(entityIdentifier)}/removeGrant',
    exceptionFnMap: _exceptionFns,
  );
}