addPermission method
Adds a statement to a topic's access control policy, granting access for the specified Amazon Web Services accounts to the specified actions.
May throw AuthorizationErrorException.
May throw InternalErrorException.
May throw InvalidParameterException.
May throw NotFoundException.
Parameter awsAccountId :
The Amazon Web Services account IDs of the users (principals) who will be
given access to the specified actions. The users must have Amazon Web
Services account, but do not need to be signed up for this service.
Parameter actionName :
The action you want to allow for the specified principal(s).
Valid values: Any Amazon SNS action name, for example
Publish.
Parameter label :
A unique identifier for the new policy statement.
Parameter topicArn :
The ARN of the topic whose access control policy you wish to modify.
Implementation
Future<void> addPermission({
required List<String> awsAccountId,
required List<String> actionName,
required String label,
required String topicArn,
}) async {
final $request = <String, String>{
if (awsAccountId.isEmpty)
'AWSAccountId': ''
else
for (var i1 = 0; i1 < awsAccountId.length; i1++)
'AWSAccountId.member.${i1 + 1}': awsAccountId[i1],
if (actionName.isEmpty)
'ActionName': ''
else
for (var i1 = 0; i1 < actionName.length; i1++)
'ActionName.member.${i1 + 1}': actionName[i1],
'Label': label,
'TopicArn': topicArn,
};
await _protocol.send(
$request,
action: 'AddPermission',
version: '2010-03-31',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
);
}