removePermission method
Revokes function-use permission from an AWS service or another account. You can get the ID of the statement from the output of GetPolicy.
May throw ServiceException. May throw ResourceNotFoundException. May throw InvalidParameterValueException. May throw TooManyRequestsException. May throw PreconditionFailedException.
Parameter functionName
:
The name 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
:
Only update the policy 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 {
ArgumentError.checkNotNull(functionName, 'functionName');
_s.validateStringLength(
'functionName',
functionName,
1,
140,
isRequired: true,
);
ArgumentError.checkNotNull(statementId, 'statementId');
_s.validateStringLength(
'statementId',
statementId,
1,
100,
isRequired: true,
);
_s.validateStringLength(
'qualifier',
qualifier,
1,
128,
);
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,
);
}