removePermission method
Revokes function-use permission from an Amazon Web Services service or another Amazon Web Services account. You can get the ID of the statement from the output of GetPolicy.
May throw InvalidParameterValueException.
May throw PreconditionFailedException.
May throw ResourceNotFoundException.
May throw ServiceException.
May throw TooManyRequestsException.
Parameter functionName :
The name or ARN of the Lambda function, version, or alias.
Name formats
-
Function name –
my-function(name-only),my-function:v1(with alias). -
Function ARN –
arn:aws:lambda:us-west-2:123456789012:function:my-function. -
Partial ARN –
123456789012:function:my-function.
Parameter statementId :
Statement ID of the permission to remove.
Parameter qualifier :
Specify a version or alias to remove permissions from a published version
of the function.
Parameter revisionId :
Update the policy only if the revision ID matches the ID that's specified.
Use this option to avoid modifying a policy that has changed since you
last read it.
Implementation
Future<void> removePermission({
required String functionName,
required String statementId,
String? qualifier,
String? revisionId,
}) async {
final $query = <String, List<String>>{
if (qualifier != null) 'Qualifier': [qualifier],
if (revisionId != null) 'RevisionId': [revisionId],
};
await _protocol.send(
payload: null,
method: 'DELETE',
requestUri:
'/2015-03-31/functions/${Uri.encodeComponent(functionName)}/policy/${Uri.encodeComponent(statementId)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
}