Show / Hide Table of Contents

Add New Function to Module File

The new function command is used to add a function to an existing module. The command can either create a C# or a Javascript function using the --language option.

Arguments

The new function command takes a single argument that specifies the function name.

lash new function MyNewFunction

Options

--namespace <VALUE>

(optional) Root namespace for project (default: same as function name)

--working-directory <VALUE>

(optional) New function project parent directory (default: current directory)

--framework|-f <VALUE>

(optional) Target .NET framework (default: 'netcoreapp3.1')

--language|-l <LANGUAGE>

(optional) Select programming language for generated code (default: csharp)

--type|-t <TYPE>

(optional) Function type (one of: apigateway, customresource, generic, queue, schedule, topic, websocket; default: prompt)

--timeout <SECONDS>

(optional) Function timeout in seconds (default: 30)

--memory <MB>

(optional) Function memory in megabytes (default: 256)

Examples

Create a new, generic Lambda C# function

Using PowerShell/Bash:

lash new function --type generic MyNewFunction

Output:

LambdaSharp CLI (v0.5) - Create new LambdaSharp module, function, or resource
Created project file: MyNewFunction\MyNewFunction.csproj
Created function file: MyNewFunction\Function.cs

Done (finished: 1/18/2019 1:17:14 PM; duration: 00:00:00.1047835)

Create a new Javascript function

Using PowerShell/Bash:

lash new function --language javascript MyNewFunction

Output:

LambdaSharp CLI (v0.5) - Create new LambdaSharp module or function
Created function file: MyNewFunction\index.js

Done (finished: 1/18/2019 1:17:47 PM; duration: 00:00:00.1073753
In This Article
Back to top Generated by DocFX