The template file is used to define the configuration file used by the function, which is usually placed under the function project Directory. Template files can be managed through code management tools together with function codes and test event files. Currently, template files support YAML Format. Standard use of template files Tencent Cloud serverless application model (Tencent Cloud Serverless Application Model,TCSAM) .
The template file is used to describe the configuration information such as the function and Associate's trigger. This document takes a simple template file as an example, which is as follows:
Resources:
default:
Type: TencentCloud::Serverless::Namespace
hello_world:
Type: TencentCloud::Serverless::Function
Properties:
CodeUri: ./hello_world
Description: This is a template function
Environment:
Variables:
ENV_FIRST: env1
ENV_SECOND: env2
Handler: index.main_handler
MemorySize: 128
Runtime: Python3.6
Timeout: 3
Globals:
Function:
Timeout: 10
The example specifies the function name hello_world and related attributes such as Entry function main.main_handler, runtime Python 3.6, code file location, environment variable, memory size, timeout, and so on.
The YAML format uses a hierarchical structure to define nested content.
For details, values, and other information at each level, see TCSAM The definition of.
Was this page helpful?