removePermission method

Future<void> removePermission({
  1. required String functionName,
  2. required String statementId,
  3. String? qualifier,
  4. String? revisionId,
})

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 namemy-function (name-only), my-function:v1 (with alias).
  • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function.
  • Partial ARN123456789012:function:my-function.
You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

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,
  );
}