removeResourcePermission method

Future<void> removeResourcePermission({
  1. required String principalId,
  2. required String resourceId,
  3. String? authenticationToken,
  4. PrincipalType? principalType,
})

Removes the permission for the specified principal from the specified resource.

May throw UnauthorizedOperationException. May throw UnauthorizedResourceAccessException. May throw FailedDependencyException. May throw ServiceUnavailableException.

Parameter principalId : The principal ID of the resource.

Parameter resourceId : The ID of the resource.

Parameter authenticationToken : Amazon WorkDocs authentication token. Not required when using AWS administrator credentials to access the API.

Parameter principalType : The principal type of the resource.

Implementation

Future<void> removeResourcePermission({
  required String principalId,
  required String resourceId,
  String? authenticationToken,
  PrincipalType? principalType,
}) async {
  ArgumentError.checkNotNull(principalId, 'principalId');
  _s.validateStringLength(
    'principalId',
    principalId,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateStringLength(
    'resourceId',
    resourceId,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'authenticationToken',
    authenticationToken,
    1,
    8199,
  );
  final headers = <String, String>{
    if (authenticationToken != null)
      'Authentication': authenticationToken.toString(),
  };
  final $query = <String, List<String>>{
    if (principalType != null) 'type': [principalType.toValue()],
  };
  await _protocol.send(
    payload: null,
    method: 'DELETE',
    requestUri:
        '/api/v1/resources/${Uri.encodeComponent(resourceId)}/permissions/${Uri.encodeComponent(principalId)}',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}