addResourcePermissions method
Creates a set of permissions for the specified folder or document. The resource permissions are overwritten if the principals already have different permissions.
May throw FailedDependencyException.
May throw ProhibitedStateException.
May throw ServiceUnavailableException.
May throw UnauthorizedOperationException.
May throw UnauthorizedResourceAccessException.
Parameter principals :
The users, groups, or organization being granted permission.
Parameter resourceId :
The ID of the resource.
Parameter authenticationToken :
Amazon WorkDocs authentication token. Not required when using Amazon Web
Services administrator credentials to access the API.
Parameter notificationOptions :
The notification options.
Implementation
Future<AddResourcePermissionsResponse> addResourcePermissions({
required List<SharePrincipal> principals,
required String resourceId,
String? authenticationToken,
NotificationOptions? notificationOptions,
}) async {
final headers = <String, String>{
if (authenticationToken != null)
'Authentication': authenticationToken.toString(),
};
final $payload = <String, dynamic>{
'Principals': principals,
if (notificationOptions != null)
'NotificationOptions': notificationOptions,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/api/v1/resources/${Uri.encodeComponent(resourceId)}/permissions',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return AddResourcePermissionsResponse.fromJson(response);
}