获取函数异步配置列表 -j9九游会登录
功能介绍
获取指定函数所有版本的异步配置列表。
调用方法
请参见。
授权信息
账号具备所有api的调用权限,如果使用账号下的iam用户调用当前api,该iam用户需具备调用api所需的权限,具体权限要求请参见权限和授权项。
uri
get /v2/{project_id}/fgs/functions/{function_urn}/async-invoke-configs
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
string |
租户项目 id,获取方式请参见获取项目id。 |
|
function_urn |
是 |
string |
函数的urn,详细解释见functiongraph函数模型的描述。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
marker |
否 |
string |
上一次查询到的最后的记录位置。 最大长度:64 |
|
limit |
否 |
string |
每页显示的条目数量。
缺省值:10 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
x-auth-token |
是 |
string |
用户token。 通过调用iam服务获取用户token接口获取(响应消息头中x-subject-token的值)。 |
|
content-type |
是 |
string |
消息体的类型(格式) |
响应参数
状态码: 200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
async_invoke_configs |
array of listfunctionasyncinvokeconfigresult objects |
函数异步配置列表。 |
|
count |
long |
列表总数。 最小值:0 |
|
page_info |
pageinfo object |
页面信息 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
func_urn |
string |
函数urn。 最小长度:1 最大长度:269 |
|
max_async_event_age_in_seconds |
integer |
消息最大存活时长,取值范围[60,86400]。单位:秒。 |
|
max_async_retry_attempts |
integer |
异步调用失败后的最大重试次数,默认值为3。取值范围[0,8]。 |
|
destination_config |
funcasyncdestinationconfig object |
异步调用目标。 |
|
created_time |
string |
异步调用配置的创建时间。 |
|
last_modified |
string |
异步调用配置的最后更改时间。 |
|
enable_async_status_log |
boolean |
开启异步调用状态持久化 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
on_success |
funcdestinationconfig object |
当函数执行成功时,函数计算将调用该配置对应的目标。 |
|
on_failure |
funcdestinationconfig object |
当函数执行失败(系统错误或函数内部错误)时,函数计算将调用该配置对应的目标。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
destination |
string |
目标类型。
枚举值:
|
|
param |
string |
通知目标服务对应参数,json字符串。
|
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
next_marker |
long |
下一次读取位置 |
|
previous_marker |
long |
上一次读取位置 |
|
current_count |
long |
当前页总数 |
请求示例
获取函数异步配置列表。
get /v2/{project_id}/fgs/functions/{function_urn}/async-invoke-configs
响应示例
状态码: 200
ok
{
"async_invoke_configs" : [ {
"func_urn" : "urn:fss:{region}:5691ba790e2b46ceb38316xxxxxxxxxx:function:default:test_async:latest",
"max_async_event_age_in_seconds" : 60,
"max_async_retry_attempts" : 1,
"destination_config" : {
"on_success" : {
"destination" : "functiongraph",
"param" : "{\"func_urn\":\"urn:fss:{region}:5691ba790e2b46ceb38316xxxxxxxxxx:function:default:testpython:latest\"}"
},
"on_failure" : {
"destination" : "functiongraph",
"param" : "{\"func_urn\":\"urn:fss:{region}:5691ba790e2b46ceb38316xxxxxxxxxx:function:default:testpython:latest\"}"
}
},
"created_time" : "2021-03-04t14:50:02 08:00",
"last_modified" : "2021-03-04 14:50:02"
} ],
"count" : 2,
"page_info" : {
"next_marker" : 2,
"previous_marker" : 0,
"current_count" : 2
}
}
sdk代码示例
sdk代码示例如下。
java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
packagecom.huaweicloud.sdk.test; importcom.huaweicloud.sdk.core.auth.icredential; importcom.huaweicloud.sdk.core.auth.basiccredentials; importcom.huaweicloud.sdk.core.exception.connectionexception; importcom.huaweicloud.sdk.core.exception.requesttimeoutexception; importcom.huaweicloud.sdk.core.exception.serviceresponseexception; importcom.huaweicloud.sdk.functiongraph.v2.region.functiongraphregion; importcom.huaweicloud.sdk.functiongraph.v2.*; importcom.huaweicloud.sdk.functiongraph.v2.model.*; publicclass listfunctionasyncinvokeconfigsolution{ publicstaticvoidmain(string[]args){ // the ak and sk used for authentication are hard-coded or stored in plaintext, which has great security risks. it is recommended that the ak and sk be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // in this example, ak and sk are stored in environment variables for authentication. before running this example, set environment variables cloud_sdk_ak and cloud_sdk_sk in the local environment stringak=system.getenv("cloud_sdk_ak"); stringsk=system.getenv("cloud_sdk_sk"); icredentialauth=newbasiccredentials() .withak(ak) .withsk(sk); functiongraphclientclient=functiongraphclient.newbuilder() .withcredential(auth) .withregion(functiongraphregion.valueof(" |
python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# coding: utf-8 from huaweicloudsdkcore.auth.credentials import basiccredentials from huaweicloudsdkfunctiongraph.v2.region.functiongraph_region import functiongraphregion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkfunctiongraph.v2 import * if __name__ == "__main__": # the ak and sk used for authentication are hard-coded or stored in plaintext, which has great security risks. it is recommended that the ak and sk be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # in this example, ak and sk are stored in environment variables for authentication. before running this example, set environment variables cloud_sdk_ak and cloud_sdk_sk in the local environment ak = __import__('os').getenv("cloud_sdk_ak") sk = __import__('os').getenv("cloud_sdk_sk") credentials = basiccredentials(ak, sk) \ client = functiongraphclient.new_builder() \ .with_credentials(credentials) \ .with_region(functiongraphregion.value_of(" |
go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
packagemain import( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" functiongraph"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/functiongraph/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/functiongraph/v2/model" region"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/functiongraph/v2/region" ) funcmain(){ // the ak and sk used for authentication are hard-coded or stored in plaintext, which has great security risks. it is recommended that the ak and sk be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // in this example, ak and sk are stored in environment variables for authentication. before running this example, set environment variables cloud_sdk_ak and cloud_sdk_sk in the local environment ak:=os.getenv("cloud_sdk_ak") sk:=os.getenv("cloud_sdk_sk") auth:=basic.newcredentialsbuilder(). withak(ak). withsk(sk). build() client:=functiongraph.newfunctiongraphclient( functiongraph.functiongraphclientbuilder(). withregion(region.valueof(" |
更多
更多编程语言的sdk代码示例,请参见的代码示例页签,可生成自动对应的sdk代码示例。
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
ok |
错误码
请参见错误码。
相关文档
意见反馈
文档内容是否对您有帮助?
如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨