Publica uma versão de layer no Function Compute.
Para obter mais informações sobre layers e versões de layer, consulte Configure layers personalizados para uma função.
Sintaxe
{
"Type": "ALIYUN::FC::Layer",
"Properties": {
"CompatibleRuntime": List,
"Description": String,
"LayerName": String,
"Code": Map
}
}
Propriedades
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrição |
|
CompatibleRuntime |
List |
Sim |
Não |
Runtimes compatíveis com o layer. |
Valores válidos:
|
|
Description |
String |
Não |
Não |
Descrição do layer. |
Nenhuma. |
|
LayerName |
String |
Sim |
Não |
Nome do layer. |
O nome deve ter de 1 a 64 caracteres. |
|
Code |
Map |
Sim |
Não |
Pacote ZIP do código da função. |
Para obter mais informações, consulte Sintaxe de Code e Propriedades de Code. |
Sintaxe de Code
"Code": {
"ZipFile": String,
"OssObjectName": String,
"OssBucketName": String
}
Propriedades de Code
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrição |
|
ZipFile |
String |
Não |
Não |
Conteúdo codificado em Base64 do pacote ZIP. |
ZipFile tem precedência sobre OssBucketName e OssObjectName. |
|
OssObjectName |
String |
Não |
Não |
Nome do objeto OSS do pacote ZIP. |
Especifique OssBucketName e OssObjectName. |
|
OssBucketName |
String |
Não |
Não |
Nome do bucket OSS que armazena o pacote ZIP. |
Especifique OssBucketName e OssObjectName. |
Valores de retorno
Fn::GetAtt
LayerName: nome do layer.
Version: versão do layer.
Arn: Alibaba Cloud Resource Name (ARN) do layer.
Exemplos
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"CompatibleRuntime": {
"Type": "Json",
"Description": "The runtime environment supported by the layer. For example:nodejs12, nodejs10, nodejs8, nodejs6, python3",
"MinLength": 1,
"Default": "[\n \"python3\"\n]"
},
"Description": {
"Type": "String",
"Description": "The description of the layer.",
"Default": "test123"
},
"LayerName": {
"Type": "String",
"Description": "The name of layer",
"AllowedPattern": "[a-zA-Z][_a-zA-Z0-9-]+",
"MinLength": 1,
"MaxLength": 64,
"Default": "test123"
},
"Code": {
"Type": "Json",
"Description": "The code of layer.",
"Default": "{\n \"OssBucketName\": \"you_bucket_name\",\n \"OssObjectName\": \"index.py\"\n}"
}
},
"Resources": {
"Layer": {
"Type": "ALIYUN::FC::Layer",
"Properties": {
"CompatibleRuntime": {
"Ref": "CompatibleRuntime"
},
"Description": {
"Ref": "Description"
},
"LayerName": {
"Ref": "LayerName"
},
"Code": {
"Ref": "Code"
}
}
}
},
"Outputs": {
"LayerName": {
"Description": "The name of layer",
"Value": {
"Fn::GetAtt": [
"Layer",
"LayerName"
]
}
},
"Version": {
"Description": "The version of the layer resource.",
"Value": {
"Fn::GetAtt": [
"Layer",
"Version"
]
}
},
"Arn": {
"Description": "The name of the layer resource.",
"Value": {
"Fn::GetAtt": [
"Layer",
"Arn"
]
}
}
}
}