modifyDocumentPermission method
Shares a Amazon Web Services Systems Manager document (SSM document)publicly or privately. If you share a document privately, you must specify the Amazon Web Services user IDs for those people who can use the document. If you share a document publicly, you must specify All as the account ID.
May throw DocumentLimitExceeded.
May throw DocumentPermissionLimit.
May throw InternalServerError.
May throw InvalidDocument.
May throw InvalidPermissionType.
Parameter name :
The name of the document that you want to share.
Parameter permissionType :
The permission type for the document. The permission type can be
Share.
Parameter accountIdsToAdd :
The Amazon Web Services users that should have access to the document. The
account IDs can either be a group of account IDs or All. You must
specify a value for this parameter or the AccountIdsToRemove
parameter.
Parameter accountIdsToRemove :
The Amazon Web Services users that should no longer have access to the
document. The Amazon Web Services user can either be a group of account
IDs or All. This action has a higher priority than
AccountIdsToAdd. If you specify an ID to add and the same ID
to remove, the system removes access to the document. You must specify a
value for this parameter or the AccountIdsToAdd parameter.
Parameter sharedDocumentVersion :
(Optional) The version of the document to share. If it isn't specified,
the system choose the Default version to share.
Implementation
Future<void> modifyDocumentPermission({
required String name,
required DocumentPermissionType permissionType,
List<String>? accountIdsToAdd,
List<String>? accountIdsToRemove,
String? sharedDocumentVersion,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonSSM.ModifyDocumentPermission'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Name': name,
'PermissionType': permissionType.value,
if (accountIdsToAdd != null) 'AccountIdsToAdd': accountIdsToAdd,
if (accountIdsToRemove != null)
'AccountIdsToRemove': accountIdsToRemove,
if (sharedDocumentVersion != null)
'SharedDocumentVersion': sharedDocumentVersion,
},
);
}