FunctionCode
- class aws_cdk.aws_cloudfront.FunctionCode
Bases:
object
Represents the function’s source code.
- 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 )
Methods
- abstract render()
renders the function code.
- Return type:
str
Static Methods
- classmethod from_file(*, file_path)
Code from external file for function.
- Parameters:
file_path (
str
) – The path of the file to read the code from.- Return type:
- Returns:
code object with contents from file.
- classmethod from_inline(code)
Inline code for function.
- Parameters:
code (
str
) – The actual function code.- Return type:
- Returns:
code object with inline code.