Class FunctionCode
Represents the function's source code.
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class FunctionCode : DeputyBase
Syntax (vb)
Public MustInherit Class FunctionCode Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
var store = new KeyValueStore(this, "KeyValueStore");
new Function(this, "Function", new FunctionProps {
Code = FunctionCode.FromInline("function handler(event) { return event.request }"),
// Note that JS_2_0 must be used for Key Value Store support
Runtime = FunctionRuntime.JS_2_0,
KeyValueStore = store
});
Synopsis
Constructors
FunctionCode() | Represents the function's source code. |
Methods
FromFile(IFileCodeOptions) | Code from external file for function. |
FromInline(string) | Inline code for function. |
Render() | renders the function code. |
Constructors
FunctionCode()
Represents the function's source code.
protected FunctionCode()
Remarks
ExampleMetadata: infused
Examples
var store = new KeyValueStore(this, "KeyValueStore");
new Function(this, "Function", new FunctionProps {
Code = FunctionCode.FromInline("function handler(event) { return event.request }"),
// Note that JS_2_0 must be used for Key Value Store support
Runtime = FunctionRuntime.JS_2_0,
KeyValueStore = store
});
Methods
FromFile(IFileCodeOptions)
Code from external file for function.
public static FunctionCode FromFile(IFileCodeOptions options)
Parameters
- options IFileCodeOptions
the options for the external file.
Returns
code object with contents from file.
Remarks
ExampleMetadata: infused
FromInline(string)
Inline code for function.
public static FunctionCode FromInline(string code)
Parameters
- code string
The actual function code.
Returns
code object with inline code.
Remarks
ExampleMetadata: infused
Render()
renders the function code.
public abstract string Render()
Returns
Remarks
ExampleMetadata: infused