Querying Metadata of a Flow Instance
Function
This API is used to query the instance metadata of a flow.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
URI
GET /v2/{project_id}/fgs/workflows/{workflow_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID. Constraints N/A. Range The value contains 32 characters. Only letters and digits are allowed. Default Value N/A. |
| workflow_id | Yes | String | Definition Flow ID. Constraints N/A. Range 1 to 512 characters Default Value N/A. |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| id | String | Unique flow ID. |
| workflow_urn | String | Definition Flow URN. The format is as follows: urn:fss:<region_id>:<project_id>:workflow:<package>:<workflow_name>:<version> Notes: Currently, only default is supported for package. Currently, only latest is supported for version. Range N/A. |
| created_time | String | Definition Flow creation time. Format: yyyy-MM-ddTHH:mm:ssZ Range UTC time |
| updated_time | String | Definition Flow modification time in the format of yyyy-MM-ddTHH:mm:ssZ. Range UTC time |
| created_by | String | Definition Flow creator. Range N/A. |
| lts_group_id | String | Definition Express flow log group ID. Range N/A. |
| lts_stream_id | String | Definition Express flow log stream ID. Range N/A. |
| definition | WorkflowCreateBody object | Definition Request body for creating a flow. Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition Name of a flow. Range 1 to 64 characters |
| description | String | Definition Flow description. Range 1 to 512 characters |
| start | String | Definition ID of the start node in a flow. Range 1 to 256 characters |
| triggers | Array of Trigger objects | Definition List of triggers in a flow. Range 0 to 200 triggers |
| functions | Array of Function objects | Definition List of functions in a flow. Range 0 to 100 functions |
| states | Array of OperationState objects | Definition List of nodes in a flow. Range 1 to 100 nodes |
| constants | Object | Definition Flow constant. Range N/A. |
| retries | Array of Retry objects | Definition List of retry policies for a flow. Range 0 to 200 policies |
| mode | String | Definition Flow mode. The default mode is NORMAL. Range |
| express_config | ExpressConfig object | Definition Express flow configuration. This parameter is required when mode is set to EXPRESS. |
| enterprise_project_id | String | Definition Enterprise project of a flow. Range 0 to 64 characters |
| enable_stream_response | Boolean | Definition Whether streaming response is supported. Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| trigger_name | String | Definition Trigger name. Range N/A. |
| trigger_type | String | Definition Trigger type. Range |
| enabled | Boolean | Definition Whether to enable the trigger. Range N/A. |
| trigger_config | OBSTriggerConfig object | Definition OBS trigger configuration. Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| bucket | String | Definition OBS bucket name. Range N/A. |
| events | Array of strings | Definition OBS event list. Range N/A. |
| prefix | String | Definition OBS object name prefix. Range N/A. |
| suffix | String | Definition OBS object name suffix. Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition Function name, which must be unique in a flow. Range N/A. |
| operation | String | Definition Function URN. Range N/A. |
| metadata | Object | Definition Extended information about the function, which is customized by users. Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| action_mode | String | Definition Node execution mode. Range |
| actions | Array of Action objects | Definition Node execution actions. Range N/A. |
| on_errors | Array of OnError objects | Definition List of node execution error handling policies. Range N/A. |
| id | String | Definition Node ID, which is unique in a flow. Range N/A. |
| name | String | Definition Node name. Range N/A. |
| type | String | Definition Node type list. Range |
| end | Boolean | Definition Whether the node is an end node. Range N/A. |
| transition | String | Definition ID of the next node. Range N/A. |
| state_data_filter | StateDataFilter object | Definition Filter expression. Range N/A. |
| duration | Long | Definition Waiting time, in seconds. This parameter is mandatory and valid only when the node type is Sleep. Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| function_ref | FunctionRef object | Definition Function invocation information. Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| ref_name | String | Definition Function reference name, which must be the same as the name in the outer functions. Range N/A. |
| invoke_mode | String | Definition Function invocation mode. Currently, only synchronous invocation is supported. Range |
| arguments | Object | Definition Input parameter for function execution. Constants in constants can be referenced. Definition format: parameter path | constant value/constant path Parameter path: The JsonPath of the input parameter, for example, $.a.b[0].c. The constant value can be of the numeric, string (enclosed in single quotation marks), or Boolean type. The constant path is the JsonPath path of the constant, but the root node must be represented by $CONST, for example, $CONST.a.b. Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| error | String | Definition Error matching expression, which is used to filter exceptions. Range N/A. |
| transition | String | Definition ID of the next node. Range N/A. |
| retry_ref | String | Definition Retry policy name. Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| input | String | Definition Input filter expression (JSONPath). Range N/A. |
| output | String | Definition Output filter expression (JSONPath). Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition Retry policy name, which must be unique in a flow. Range N/A. |
| delay | Long | Definition Retry interval, in seconds. If the parameter is not set, the value is 1 by default. Range N/A. |
| max_attempts | Long | Definition Maximum number of retry times. If this parameter is not set, the default value 3 is used. Range N/A. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error description. |
| request_id | String | Request ID. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error description. |
| request_id | String | Request ID. |
Example Requests
Query the metadata of function flow {workflow_id}.
GET /v2/{project_id}/fgs/workflows/{workflow_id} Example Responses
Status code: 200
{
"id" : "fa466a62-73a2-49b9-9261-358dfe873b6e",
"created_time" : "2022-09-01T01:29:46Z",
"updated_time" : "2022-09-13T07:27:02Z",
"workflow_urn" : "urn:fss:cn-north-7:c53626012ba84727b938ca8bf03108ef:workflow:default:flow_nxy:latest",
"lts_group_id" : "124cef5b-d494-490d-af94-166c4bef0e0d",
"lts_stream_id" : "07e89ef7-d038-4018-97de-167b255de61f",
"definition" : {
"name" : "test-flow",
"start" : "Start",
"functions" : [ {
"name" : "func1",
"operation" : "urn:fss:cn-north-7:c53626012ba84727b938ca8bf03108ef:function:default:workflow_python:latest"
} ],
"states" : [ {
"id" : "End",
"name" : "End",
"type" : "End",
"end" : true,
"transition" : "Node1",
"actions" : [ ]
} ],
"constants" : {
"input" : {
"bucket" : "default_bucket"
}
},
"retries" : [ {
"name" : "retry-policy1"
} ]
}
} SDK Sample Code
The SDK sample code is as follows.
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 | package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.functiongraph.v2.region.FunctionGraphRegion; import com.huaweicloud.sdk.functiongraph.v2.*; import com.huaweicloud.sdk.functiongraph.v2.model.*; public class ShowWorkFlowSolution { public static void main(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 String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); FunctionGraphClient client = FunctionGraphClient.newBuilder() .withCredential(auth) .withRegion(FunctionGraphRegion.valueOf("<YOUR REGION>")) .build(); ShowWorkFlowRequest request = new ShowWorkFlowRequest(); request.withWorkflowId("{workflow_id}"); try { ShowWorkFlowResponse response = client.showWorkFlow(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
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 | # coding: utf-8 import os 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 = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = FunctionGraphClient.new_builder() \ .with_credentials(credentials) \ .with_region(FunctionGraphRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowWorkFlowRequest() request.workflow_id = "{workflow_id}" response = client.show_work_flow(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
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 42 43 44 45 46 47 48 49 50 | package main 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" ) func 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 := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := functiongraph.FunctionGraphClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := functiongraph.NewFunctionGraphClient(hcClient) request := &model.ShowWorkFlowRequest{} request.WorkflowId = "{workflow_id}" response, err := client.ShowWorkFlow(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
More
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 500 | Internal Server Error |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot