remove_permission
async
¶
remove_permission(
function_name: NamespacedFunctionName,
statement_id: NamespacedStatementId,
*,
config_overrides: Optional[AsyncLambdaClientConfig] = None,
qualifier: Optional[NumericLatestPublishedOrAliasQualifier] = None,
revision_id: Optional[String] = None,
) -> None
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.
Parameters:
-
function_name(NamespacedFunctionName) –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.
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.
-
-
statement_id(NamespacedStatementId) –Statement ID of the permission to remove.
-
qualifier(Optional[NumericLatestPublishedOrAliasQualifier], default:None) –Specify a version or alias to remove permissions from a published version of the function.
-
revision_id(Optional[String], default:None) –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.
Raises:
-
InvalidParameterValueException–One of the parameters in the request is not valid.
-
PreconditionFailedException–The RevisionId provided does not match the latest RevisionId for the Lambda function or alias.
-
For AddPermission and RemovePermission API operations: Call
GetPolicyto retrieve the latest RevisionId for your resource. -
For all other API operations: Call
GetFunctionorGetAliasto retrieve the latest RevisionId for your resource.
-
-
PublicPolicyException–The resource-based policy you tried to add to the Lambda resource would grant public access to it, which isn't allowed.
-
ResourceNotFoundException–The resource specified in the request does not exist.
-
ServiceException–The Lambda service encountered an internal error.
-
TooManyRequestsException–The request throughput limit was exceeded. For more information, see Lambda quotas.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To remove a Lambda function's permissions The following example removes a permissions statement named xaccount from the PROD alias of a function named my-function.
>>> await client.remove_permission(function_name='my-function', qualifier='PROD', statement_id='xaccount')
Source code in docs_src/capo_lambda/_services/async__lambda.py
6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 | |