update_function
¶
update_function(
name: FunctionName,
if_match: string,
function_config: FunctionConfig,
function_code: FunctionBlob,
*,
config_overrides: Optional[CloudFrontClientConfig] = None,
) -> UpdateFunctionResult
Updates a CloudFront function.
You can update a function's code or the comment that describes the function. You cannot update a function's name.
To update a function, you provide the function's name and version (ETag value) along with the updated function code. To get the name and version, you can use ListFunctions and DescribeFunction.
Parameters:
-
name(FunctionName) –The name of the function that you are updating.
-
if_match(string) –The current version (
ETagvalue) of the function that you are updating, which you can get usingDescribeFunction. -
function_config(FunctionConfig) –Configuration information about the function.
-
function_code(FunctionBlob) –The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
Raises:
-
FunctionSizeLimitExceeded–The function is too large. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.
-
InvalidArgument–An argument is invalid.
-
InvalidIfMatchVersion–The
If-Matchversion is missing or not valid. -
NoSuchFunctionExists–The function does not exist.
-
PreconditionFailed–The precondition in one or more of the request fields evaluated to
false. -
UnsupportedOperation–This operation is not supported in this Amazon Web Services Region.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To update a function Use the following command to update a function.
>>> client.update_function(name='my-function-name', function_config={'Comment': 'my-changed-comment', 'Runtime': 'cloudfront-js-2.0', 'KeyValueStoreAssociations': {'Quantity': 1, 'Items': [{'KeyValueStoreARN': 'arn:aws:cloudfront::123456789012:key-value-store/54947df8-0e9e-4471-a2f9-9af509fb5889'}]}}, function_code='function-code-changed.js', if_match='ETVPDKIKX0DER')
Source code in docs_src/capo_cloudfront/_services/cloud_front.py
9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 | |