All Products
Search
Document Center

Function Compute (2.0):CreateLayerVersion

Last Updated:Apr 18, 2024

Releases a layer version.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request syntax

POST /2021-04-06/layers/{layerName}/versions

Request parameters

ParameterTypeRequiredDescriptionExample
layerNamestringYes

The layer name. The name can be up to 128 character in length.

MyLayer
bodyobjectNo

The information about the layer.

descriptionstringNo

The layer description. The description can be up to 256 characters.

test
compatibleRuntimearrayNo

The runtimes that are supported by the layer.

stringNo

The runtime. Valid values: nodejs20, nodejs18, nodejs16, nodejs14, nodejs12, nodejs10, nodejs8, nodejs6, python3.10, python3.9, python3, python2.7, java11, java8, php7.2, go1, dotnetcore3.1, dotnetcore2.1, custom.debian10, and custom.

python3
CodeCodeYes

The layer code.

X-Fc-Account-IdstringNo

The ID of your Alibaba Cloud account.

188077086902****
X-Fc-DatestringNo

The time when the function is invoked. The value is in the EEE,d MMM yyyy HH:mm:ss GMT format.

Wed, 11 May 2022 09:00:00 GMT
X-Fc-Trace-IdstringNo

The trace ID of the invocation request of Function Compute.

r4isu4sls****

Response parameters

ParameterTypeDescriptionExample
headersobject
ETagstring

The identifier of the layer version.

xxx
object

The detailed information about the layer.

layerNamestring

The layer name.

MyLayer
versioninteger

The layer version.

1
descriptionstring

The description of the layer version.

the first layer
codeOutputCodeLocation

The information about the layer code package.

codesizelong

The size of the layer code package. Unit: bytes.

421
codeChecksumstring

The CRC-64 value of the layer code package. The value is calculated based on the **ECMA-182 **standard.

2825179536350****
createTimestring

The time when the layer version was created. The time is in the yyyy-MM-ddTHH:mm:ssZ format.

2022-01-01T11:08:00Z
aclinteger

The access mode of the layer. Digit 0 specifies that the layer is private and digit 1 specifies that the layer is public. By default, public layers are public. Custom layers can be set to private or public.

0
compatibleRuntimearray

The runtimes that are supported by the layer.

string

The runtime. Valid values: nodejs20, nodejs18, nodejs16, nodejs14, nodejs12, nodejs10, nodejs8, nodejs6, python3.10, python3.9, python3, python2.7, java11, java8, php7.2, go1, dotnetcore3.1, dotnetcore2.1, custom.debian10, and custom.

python3
arnstring

The Alibaba Cloud Resource Name (ARN) of the layer.

xxxxxxxx#Layer-name#1

Examples

Sample success responses

JSONformat

{
  "layerName": "MyLayer",
  "version": 1,
  "description": "the first layer",
  "code": {
    "repositoryType": "OSS",
    "location": "https://xyz.oss-cnxxx.aliyuncs.com/xxx/xxx/xxx"
  },
  "codesize": 421,
  "codeChecksum": "2825179536350****",
  "createTime": "2022-01-01T11:08:00Z",
  "acl": 0,
  "compatibleRuntime": [
    "python3"
  ],
  "arn": "xxxxxxxx#Layer-name#1"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2022-12-16The internal configuration of the API is changed, but the call is not affectedsee changesets
Change itemChange content
The internal configuration of the API is changed, but the call is not affected.
2021-06-30The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: X-Fc-Account-Id
    Added Input Parameters: X-Fc-Code-Checksum
    Added Input Parameters: X-Fc-Log-Type
    Added Input Parameters: X-Fc-Invocation-Type
    Added Input Parameters: X-Fc-Date
    Added Input Parameters: X-Fc-Trace-Id
2021-06-30The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: X-Fc-Account-Id
2021-06-30The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    delete Input Parameters: X-Fc-Account-Id