函数工作流 FunctionGraph-创建触发器:请求示例

时间:2023-11-01 16:25:44

请求示例

  • 创建指定obs触发器。

    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}{  "trigger_type_code" : "OBS",  "trigger_status" : "ACTIVE",  "event_data" : {    "bucket" : "input-picture2",    "events" : [ "s3:ObjectCreated:*" ],    "name" : "obs-event-1ec7"  }}
  • 创建指定apig触发器。

    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}{  "trigger_type_code" : "APIG",  "trigger_status" : "ACTIVE",  "event_data" : {    "func_info" : {      "timeout" : 5000    },    "name" : "API_test_gxz_v1_billing",    "env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID",    "env_name" : "RELEASE",    "protocol" : "HTTPS",    "auth" : "NONE",    "group_id" : "318b09eb214a41488c667ecd51667e3x",    "sl_domain" : "318b09eb214a41488c667ecd51667e3x.apig.{region}.huaweicloudapis.com",    "match_mode" : "SWA",    "req_method" : "ANY",    "backend_type" : "FUNCTION",    "type" : 1,    "path" : "/test_gxz_v1_billing"  }}
  • 创建指定kafka触发器。

    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}{  "trigger_type_code" : "KAFKA",  "trigger_status" : "DISABLED",  "event_data" : {    "instance_id" : "86ad3efc-c019-460e-91e7-317b1a89f95x",    "topic_ids" : [ "PUSH_TOKEN_RECORD" ],    "batch_size" : 100  }}
  • 创建指定timer触发器。

    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}{  "trigger_type_code" : "TIMER",  "trigger_status" : "ACTIVE",  "event_data" : {    "name" : "Timer-l8v2",    "schedule" : "3m",    "schedule_type" : "Rate"  }}
  • 创建指定lts触发器(需配置访问LTS服务权限的委托)。

    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}{  "trigger_type_code" : "LTS",  "trigger_status" : "ACTIVE",  "event_data" : {    "log_group_id" : "ccd3fa30-7c86-4590-8a9d-XXX",    "log_group_name" : "function_flow_lts_group_XXX",    "log_topic_id" : "5b4944dd-9603-481d-9b91-XXX",    "log_topic_name" : "79eebdc0-3a0d-4231-b88e-XXX"  }}
  • 创建指定smn触发器。

    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}{  "trigger_type_code" : " SMN ",  "trigger_status" : "ACTIVE",  "event_data" : {    "topic_urn" : "urn:smn:{region}:{project_id}:Failed_times"  }}
support.huaweicloud.com/api-functiongraph/functiongraph_06_0122.html