華為云計(jì)算 云知識(shí) 修改指定函數(shù)流實(shí)例的元數(shù)據(jù)UpdateWorkFlow
修改指定函數(shù)流實(shí)例的元數(shù)據(jù)UpdateWorkFlow

 

功能介紹

修改指定函數(shù)流實(shí)例的元數(shù)據(jù)

調(diào)試

您可以在API Explorer中調(diào)試該接口,支持自動(dòng)認(rèn)證鑒權(quán)。API Explorer可以自動(dòng)生成SDK代碼示例,并提供SDK代碼示例調(diào)試功能。

URI

PUT /v2/{project_id}/fgs/workflows/{workflow_id}

表1 路徑參數(shù)

參數(shù)

是否必選

參數(shù)類型

描述

project_id

String

項(xiàng)目ID,獲取方式請(qǐng)參見獲取項(xiàng)目ID。

最小長度:1

最大長度:64

workflow_id

String

函數(shù)工作流 ID

最小長度:1

最大長度:512

請(qǐng)求參數(shù)

表2 請(qǐng)求Body參數(shù)

參數(shù)

是否必選

參數(shù)類型

描述

name

String

函數(shù)流名稱

最小長度:1

最大長度:64

description

String

函數(shù)流描述

最小長度:1

最大長度:512

start

String

流程開始節(jié)點(diǎn)ID

最小長度:1

最大長度:256

triggers

Array of Trigger objects

觸發(fā)器列表

functions

Array of Function objects

函數(shù)列表

states

Array of OperationState objects

函數(shù)流節(jié)點(diǎn)清單,定義參考SleepState和OperationState

constants

Object

函數(shù)流中的常量

retries

Array of Retry objects

重試策略清單

mode

String

函數(shù)流模式,當(dāng)前支持兩種模式NORMAL: 標(biāo)準(zhǔn)模式,普通模式面向普通的業(yè)務(wù)場(chǎng)景,支持長時(shí)間任務(wù),支持執(zhí)行歷史持久化和查詢,只支持異步調(diào)用EXPRESS: 快速模式,快速模式面向業(yè)務(wù)執(zhí)行時(shí)長較短,需要極致性能的場(chǎng)景,只支持流程執(zhí)行時(shí)長低于5分鐘的場(chǎng)景,不支持執(zhí)行歷史持久化,支持同步和異步調(diào)用默認(rèn)為標(biāo)準(zhǔn)模式

缺省值:NORMAL

枚舉值:

  • NORMAL

  • EXPRESS

express_config

ExpressConfig object

快速函數(shù)流模式配置,當(dāng)mode為EXPRESS時(shí)需要設(shè)置

enterprise_project_id

String

企業(yè)項(xiàng)目ID

最小長度:0

最大長度:64

enable_stream_response

Boolean

是否返回流數(shù)據(jù)

缺省值:false

表3 Trigger

參數(shù)

是否必選

參數(shù)類型

描述

trigger_name

String

觸發(fā)器名稱

最小長度:1

最大長度:256

trigger_type

String

觸發(fā)器類型 FLOWTIMER:定時(shí)觸發(fā)器 SMN :SMN觸發(fā)器 APIG:APIG觸發(fā)器(共享版) APIG_DE:APIG觸發(fā)器(專享版) OBS:OBS觸發(fā)器

最小長度:1

最大長度:32

枚舉值:

  • FLOWTIMER

  • SMN

  • APIG

  • APIG_DE

  • OBS

enabled

Boolean

是否啟用觸發(fā)器

缺省值:true

枚舉值:

  • true

  • false

trigger_config

OBSTriggerConfig object

OBS觸發(fā)器配置,當(dāng)trigger_type為OBS時(shí)需要設(shè)置

表4 OBSTriggerConfig

參數(shù)

是否必選

參數(shù)類型

描述

bucket

String

OBS桶名(trigger_type為OBS時(shí)配置)

最小長度:1

最大長度:64

events

Array of strings

OBS事件列表(trigger_type為OBS時(shí)配置)

prefix

String

對(duì)象名前綴(trigger_type為OBS時(shí)配置)

最小長度:1

最大長度:1024

suffix

String

對(duì)象名后綴(trigger_type為OBS時(shí)配置)

最小長度:1

最大長度:1024

表5 Function

參數(shù)

是否必選

參數(shù)類型

描述

name

String

函數(shù)名稱,在單個(gè)流程中,名稱需要唯一

最小長度:0

最大長度:256

operation

String

函數(shù)調(diào)用URN

最小長度:0

最大長度:256

metadata

Object

函數(shù)擴(kuò)展屬性,由用戶自己定制

表6 OperationState

參數(shù)

是否必選

參數(shù)類型

描述

action_mode

String

Action執(zhí)行模式,支持串行,并行兩種模式,默認(rèn)串行

最小長度:1

最大長度:32

枚舉值:

  • sequential

  • parallel

actions

Array of Action objects

節(jié)點(diǎn)中要執(zhí)行的操作列表

on_errors

Array of OnError objects

錯(cuò)誤處理策略

id

String

節(jié)點(diǎn)ID,需要在當(dāng)前函數(shù)流中唯一

最小長度:0

最大長度:64

name

String

節(jié)點(diǎn)名稱

最小長度:1

最大長度:256

type

String

節(jié)點(diǎn)類型

最小長度:1

最大長度:32

枚舉值:

  • Operation

  • Sleep

  • End

end

Boolean

是否是結(jié)束節(jié)點(diǎn)

transition

String

下一步驟節(jié)點(diǎn)ID

最小長度:0

最大長度:256

state_data_filter

StateDataFilter object

過濾表達(dá)式

duration

Long

時(shí)間等待節(jié)點(diǎn)等待時(shí)間(秒),節(jié)點(diǎn)類型為Sleep時(shí)為必填,節(jié)點(diǎn)類型不為Sleep時(shí)無效

最小值:0.001

最大值:86400

表7 Action

參數(shù)

是否必選

參數(shù)類型

描述

function_ref

FunctionRef object

函數(shù)調(diào)用信息

表8 FunctionRef

參數(shù)

是否必選

參數(shù)類型

描述

ref_name

String

函數(shù)引用名稱,需要和外層functions中的name對(duì)應(yīng)

最小長度:0

最大長度:256

invoke_mode

String

函數(shù)調(diào)用模式,目前只支持同步調(diào)用

最小長度:1

最大長度:32

枚舉值:

  • synchronize

  • asynchronous

arguments

Object

函數(shù)執(zhí)行時(shí)的入?yún)?,支持引用constants中的常量 定義方式:參數(shù)路徑 | 常量值/常量路徑 參數(shù)路徑指輸入?yún)?shù)的JsonPath路徑,如$.a.b[0].c 常量值可以為數(shù)字類型,字符串類型(需要用單引號(hào)括起來),布爾類型 常量路徑為常量的JsonPath路徑,但是根節(jié)點(diǎn)需要用$CONST表示,示例:$CONST.a.b

表9 OnError

參數(shù)

是否必選

參數(shù)類型

描述

error

String

錯(cuò)誤匹配表達(dá)式,用來過濾需要處理的異常

最小長度:0

最大長度:256

transition

String

下一步驟節(jié)點(diǎn)ID

最小長度:0

最大長度:256

retry_ref

String

重試策略名稱

最小長度:0

最大長度:256

表10 StateDataFilter

參數(shù)

是否必選

參數(shù)類型

描述

input

String

輸入過濾表達(dá)式(JsonPath)

最小長度:0

最大長度:256

output

String

輸出過濾表達(dá)式(JsonPath)

最小長度:0

最大長度:256

表11 Retry

參數(shù)

是否必選

參數(shù)類型

描述

name

String

重試策略名稱,在單個(gè)流程中,名稱需要唯一

最小長度:1

最大長度:256

delay

Long

重試間隔,單位:秒。若不傳,默認(rèn)為1

最小值:1

最大值:30

max_attempts

Long

最大重試次數(shù),。若不傳,默認(rèn)為3

最小值:1

最大值:8

表12 ExpressConfig

參數(shù)

是否必選

參數(shù)類型

描述

log_level

String

快速模式相關(guān)配置,僅在mode配置為EXPRESS時(shí)生效 快速模式下流程的執(zhí)行日志級(jí)別,當(dāng)前支持: ALL: 記錄所有節(jié)點(diǎn)的執(zhí)行日志 ERROR:僅記錄異常節(jié)點(diǎn)執(zhí)行日志 NONE:不記錄日志 注意:當(dāng)配置為ALL和ERROR級(jí)別時(shí)租戶需要開啟 LTS 相關(guān)權(quán)限

最小長度:1

最大長度:5

枚舉值:

  • ALL

  • ERROR

  • NONE

響應(yīng)參數(shù)

狀態(tài)碼: 200

表13 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

id

String

唯一標(biāo)識(shí)ID,流程定義ID

最小長度:1

最大長度:64

workflow_urn

String

函數(shù)工作流URN, 格式為:urn:fss:<region_id>:<project_id>:workflow:<package>:<workflow_name>:<version>注意:package當(dāng)前只支持defaultversion當(dāng)前只支持latest

name

String

流程定義名稱

最小長度:1

最大長度:64

description

String

流程定義描述

最小長度:0

最大長度:512

created_time

String

流程創(chuàng)建時(shí)間,格式:yyyy-MM-ddTHH:mm:ssZ,UTC時(shí)間

最小長度:0

最大長度:64

updated_time

String

流程修改時(shí)間,格式:yyyy-MM-ddTHH:mm:ssZ,UTC時(shí)間

最小長度:0

最大長度:64

created_by

String

流程創(chuàng)建者

最小長度:0

最大長度:64

enable_stream_response

Boolean

是否返回流數(shù)據(jù)

缺省值:false

狀態(tài)碼: 400

表14 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

error_code

String

錯(cuò)誤碼

最小長度:1

最大長度:36

error_msg

String

錯(cuò)誤描述

最小長度:2

最大長度:512

request_id

String

請(qǐng)求ID

最小長度:2

最大長度:512

狀態(tài)碼: 500

表15 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

error_code

String

錯(cuò)誤碼

最小長度:1

最大長度:36

error_msg

String

錯(cuò)誤描述

最小長度:2

最大長度:512

request_id

String

請(qǐng)求ID

最小長度:2

最大長度:512

請(qǐng)求示例

修改函數(shù)流id為{workflow_id}的函數(shù)流元數(shù)據(jù)。

PUT /v2/{project_id}/fgs/workflows/{workflow_id}

{
  "name" : "workflow_test",
  "start" : "test",
  "functions" : [ {
    "name" : "test",
    "operation" : "urn:fss:{regin}:c53626012ba84727b938ca8bf03108ef:test:latest"
  } ],
  "constants" : { },
  "states" : [ {
    "id" : "test",
    "name" : "test",
    "type" : "Operation",
    "end" : false,
    "transition" : "end",
    "actions" : [ {
      "function_ref" : {
        "ref_name" : "test",
        "arguments" : {
          "execution_name" : "$.test"
        }
      }
    } ]
  }, {
    "id" : "end",
    "name" : "end",
    "type" : "End",
    "end" : true,
    "transition" : "",
    "state_data_filter" : {
      "input" : "",
      "output" : ""
    },
    "actions" : [ ],
    "action_mode" : ""
  } ],
  "retries" : [ {
    "name" : "test"
  } ]
}

響應(yīng)示例

狀態(tài)碼: 200

Success

{
  "id" : "48aff955-ea10-4ffd-b426-190bc192dc14",
  "workflow_urn" : "urn:fss:cn-north-7:73d69ae0cfcf460190522d060f05ad:workflow:default:testflow:latest",
  "name" : "test-flow",
  "description" : "desc",
  "created_time" : "2021-01-01T00:00:00Z",
  "updated_time" : "2021-01-01T00:00:00Z",
  "created_by" : "admin"
}

狀態(tài)碼

狀態(tài)碼

描述

200

Success

400

Bad Request

500

Internal Server Error

錯(cuò)誤碼

請(qǐng)參見錯(cuò)誤碼