remove_permission
¶
remove_permission(
function_name: NamespacedFunctionName,
statement_id: NamespacedStatementId,
*,
config_overrides: Optional[LambdaClientConfig] = 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.
>>> client.remove_permission(function_name='my-function', qualifier='PROD', statement_id='xaccount')
Source code in docs_src/capo_lambda/_services/_lambda.py
6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 | |