FunctionProps
- class aws_cdk.aws_cloudfront.FunctionProps(*, code, auto_publish=None, comment=None, function_name=None, key_value_store=None, runtime=None)
Bases:
objectProperties for creating a CloudFront Function.
- Parameters:
code (
FunctionCode) – The source code of the function.auto_publish (
Optional[bool]) – A flag that determines whether to automatically publish the function to the LIVE stage when it’s created. Default: - truecomment (
Optional[str]) – A comment to describe the function. Default: - same asfunctionNamefunction_name (
Optional[str]) – A name to identify the function. Default: - generated from theidkey_value_store (
Optional[IKeyValueStoreRef]) – The Key Value Store to associate with this function. In order to associate a Key Value Store, theruntimemust becloudfront-js-2.0or newer. Default: - no key value store is associatedruntime (
Optional[FunctionRuntime]) – The runtime environment for the function. Default: FunctionRuntime.JS_1_0 (unlesskeyValueStoreis specified, thenFunctionRuntime.JS_2_0)
- ExampleMetadata:
infused
Example:
store = cloudfront.KeyValueStore(self, "KeyValueStore") cloudfront.Function(self, "Function", code=cloudfront.FunctionCode.from_inline("function handler(event) { return event.request }"), # Note that JS_2_0 must be used for Key Value Store support runtime=cloudfront.FunctionRuntime.JS_2_0, key_value_store=store )
Attributes
- auto_publish
A flag that determines whether to automatically publish the function to the LIVE stage when it’s created.
- Default:
true
- code
The source code of the function.
- comment
A comment to describe the function.
- Default:
same as
functionName
- function_name
A name to identify the function.
- Default:
generated from the
id
- key_value_store
The Key Value Store to associate with this function.
In order to associate a Key Value Store, the
runtimemust becloudfront-js-2.0or newer.- Default:
no key value store is associated
- runtime
The runtime environment for the function.
- Default:
FunctionRuntime.JS_1_0 (unless
keyValueStoreis specified, thenFunctionRuntime.JS_2_0)