同步执行工作流 -j9九游会登录
功能介绍
以同步执行方式启动工作流(仅快速模式工作流支持),暂不支持国际站局点调用
调用方法
请参见。
授权信息
账号具备所有api的调用权限,如果使用账号下的iam用户调用当前api,该iam用户需具备调用api所需的权限,具体权限要求请参见权限和授权项。
uri
post /v2/{project_id}/fgs/workflows/{workflow_id}/sync-executions
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
string |
参数解释: 租户项目 id,获取方式请参见获取项目id。 约束限制: 不涉及。 取值范围: 只能由英文字母、数字组成,且长度为32个字符。 默认取值: 不涉及。 |
|
workflow_id |
是 |
string |
参数解释: 函数工作流id。 约束限制: 不涉及。 取值范围: [1, 512] 默认取值: 不涉及。 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
headers |
否 |
object |
执行时需要的header |
|
input |
是 |
object |
定义执行时的入参,支持使用jsonpath进行映射,以及指定默认值 |
响应参数
状态码: 200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
execution_id |
string |
流程实例id |
|
status |
string |
流程执行最终状态 枚举值:
|
|
output |
object |
工作流的执行结果,json格式,仅在status为success时有值 |
|
errors |
array of syncexecutionnodeerrordetail objects |
流程执行错误信息,仅在status为fail时有值 |
|
begin_time |
string |
流程实例创建时间,格式:yyyy-mm-ddthh:mm:ssz,utc时间 |
|
end_time |
string |
流程实例结束时间,格式:yyyy-mm-ddthh:mm:ssz,utc时间 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
node_id |
string |
流程节点id |
|
error_message |
string |
错误详细信息 |
|
begin_time |
string |
流程实例创建时间,格式:yyyy-mm-ddthh:mm:ssz,utc时间 |
|
end_time |
string |
流程实例结束时间,格式:yyyy-mm-ddthh:mm:ssz,utc时间 |
状态码: 400
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
string |
错误码 最小长度:1 最大长度:36 |
|
error_msg |
string |
错误描述 最小长度:2 最大长度:512 |
状态码: 404
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
string |
错误码 最小长度:1 最大长度:36 |
|
error_msg |
string |
错误描述 最小长度:2 最大长度:512 |
状态码: 500
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
string |
错误码 最小长度:1 最大长度:36 |
|
error_msg |
string |
错误描述 最小长度:2 最大长度:512 |
请求示例
同步执行工作流。
post /{project_id}/fgs/workflows/{workflow_id}/sync-executions
{
"headers" : {
"tenantid" : "user1"
},
"input" : {
"arg1" : "argument_1",
"arg2" : "argument_2"
}
}
响应示例
状态码: 200
success
{
"execution_id" : "48aff955-ea10-4ffd-b426-190bc192dc14",
"status" : "success",
"output" : {
"result" : 200,
"message" : "success"
},
"errors" : [ {
"node_id" : "48aff955-ea10-4ffd-b426-190bc192dc14",
"error_message" : "exception happened",
"begin_time" : "2021-01-01t00:00:00z",
"end_time" : "2021-01-01t00:00:00z"
} ],
"begin_time" : "2021-01-01t00:00:00z",
"end_time" : "2021-01-01t00:00:00z"
}
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 48 49 |
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 startsyncworkflowexecutionsolution{ 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 32 33 |
# 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 40 41 |
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 |
success |
|
400 |
bad request |
|
404 |
bad request |
|
500 |
internal server error |
错误码
请参见错误码。
相关文档
意见反馈
文档内容是否对您有帮助?
如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨