update_function
async
¶
update_function(
name: FunctionName,
if_match: string,
function_config: FunctionConfig,
function_code: FunctionBlob,
*,
config_overrides: Optional[AsyncCloudFrontClientConfig] = 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.
>>> await 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/async_cloud_front.py
9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 | |