Help Center> FunctionGraph> API Reference> Function Management Zone API> Creating an Alias for a Function Version

Creating an Alias for a Function Version

Function

This API is used to create an alias for a function version.

URI

POST /v2/{project_id}/fgs/functions/{function_urn}/aliases

Table 1 Path parameters

Parameter

Mandatory

Type

Description

function_urn

Yes

String

Function URN.

project_id

Yes

String

Tenant's project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Alias name.

version

Yes

String

Version corresponding to the alias.

description

No

String

Description of the alias.

additional_version_weights

No

Object

Additional version configuration. Key indicates the name of the additional version, which cannot be LATEST. The value is the percentage (1% to 99%) of traffic to be forwarded to the additional version.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

name

String

Alias name.

description

String

Description of the alias.

version

String

Version corresponding to the alias.

last_modified

String

Latest update time.

alias_urn

String

Alias URN.

additional_version_weights

Object

Additional version configuration. Key indicates the name of the additional version, which cannot be LATEST. The value is the percentage (1% to 99%) of traffic to be forwarded to the additional version.

Example Requests

POST https://{functiongraph_endpoint}/v2/7aad83af3e8d42e99ac194e8419e2c9b/fgs/functions/urn:fss:xxxxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest/aliases

{
  "name" : "a1",
  "version" : "latest",
  "description" : ""
}

Example Responses

Status code: 200

OK

{
  "name" : "a1",
  "version" : "latest",
  "description" : "",
  "last_modified" : "2019-10-31T11:37:58+08:00",
  "alias_urn" : "urn:fss:cn-north-7:46b6f338fc3445b8846c71dfb1fbd9e8:function:default:xxxxx:!a1"
}

Status code: 404

Not Found

{
  "error_code" : "FSS.1051",
  "error_msg" : "Not found the function"
}

Status Codes

Status Code

Description

200

OK

404

Not Found

Error Codes

See Error Codes.