Updated on 2024-06-14 GMT+08:00

Obtaining the Pipeline List

Function

This API is used to obtain the pipeline list.

Calling Method

For details, see Calling APIs.

URI

POST /v3/pipelines/list

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

pipeline_name

No

String

Pipeline name. Fuzzy match query.

project_ids

No

String

Project ID. Multiple IDs are separated by commas (,). A maximum of 10 IDs are supported. This parameter is optional. If this parameter has a value, the pipeline list of the corresponding project is obtained. If this parameter does not have a value, the pipeline list of all projects on which the user has permission is obtained.

creator_ids

No

String

Creator ID. Multiple IDs are separated by commas (,). A maximum of 10 IDs are supported. This parameter is optional.

executor_ids

No

String

Executor ID. Multiple IDs are separated by commas (,). A maximum of 10 IDs are supported. This parameter is optional.

status

No

String

Pipeline running status. The value can be waiting, running, verifying, suspending, or completed.

outcome

No

String

Pipeline execution result. The value can be success, error, or aborted.

sort_key

No

String

Field used for sorting. The value can be pipeline_name, create_time, or start_time.

sort_dir

No

String

Sorting order. asc: ascending; desc: descending.

git_url

No

String

Code repository address. Only CodeHub is supported, for example, git@codehub.XXX.git.

offset

No

Integer

Offset, which is the position where the query starts. Min.: 0 (default value).

limit

No

Integer

Number of records of each query. The value ranges from 10 to 50. The default value is 10.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

offset

Integer

Offset, which is the position where the query starts. The value must be no less than 0.

limit

Integer

Number of records of each query.

total

Integer

Total number of records.

result

Array of PipelineBasicInfo objects

Pipeline list.

Table 4 PipelineBasicInfo

Parameter

Type

Description

project_id

String

Project ID.

project_name

String

Project name.

pipeline_id

String

Pipeline ID.

pipeline_name

String

Pipeline name.

creator_id

String

Pipeline creator ID

creator_name

String

Pipeline creator name.

executor_id

String

Pipeline executor ID.

executor_name

String

Pipeline executor name.

start_time

String

Start time.

create_time

String

Creation time.

watched

String

Whether the user follows a pipeline. The value can be true (follow) or false (not follow).

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

error_code

String

Error code.

Example Requests

This API is used to obtain the pipeline list. Example: The project ID is e12ed176898d4841aa9881fe9b933c87 and the creator ID is 847a5317086c41798469d0868535943a. Pipelines are sorted by pipeline name in descending order.

POST https://{endpoint}/v3/pipelines/list

{
  "pipeline_name" : "",
  "project_ids" : "e12ed176898d4841aa9881fe9b933c87",
  "creator_ids" : "847a5317086c41798469d0868535943a",
  "executor_ids" : "847a5317086c41798469d0868535943a",
  "status" : "waiting,running,verifying,handling,suspending,completed",
  "outcome" : "error,success,aborted",
  "sort_key" : "pipeline_name",
  "sort_dir" : "desc",
  "git_url" : "",
  "offset" : 4,
  "limit" : 10
}

Example Responses

Status code: 200

OK

{
  "offset" : 0,
  "limit" : 10,
  "total" : 88,
  "result" : [ {
    "project_id" : "e12ed176898d4841aa9881fe9b933c87",
    "project_name" : "Pipeline_Beta_Automatic Test",
    "pipeline_id" : "d33f98177c3e44f8841b005e1badcaed",
    "pipeline_name" : "Ma Yunduo Cang",
    "creator_id" : "847a5317086c41798469d0868535943a",
    "creator_name" : "Big beta test account",
    "executor_id" : "847a5317086c41798469d0868535943a",
    "executor_name" : "Big beta test account",
    "start_time" : "2022-09-08 17:08:02",
    "create_time" : "2022-07-28 17:02:11",
    "watched" : "true"
  }, {
    "project_id" : "e12ed176898d4841aa9881fe9b933c87",
    "project_name" : "Pipeline_Beta_Automatic Test",
    "pipeline_id" : "2ec08a45031c4d2896292a48b7fb1a30",
    "pipeline_name" : "Dedicated Test for Access Control_Do Not Delete",
    "creator_id" : "847a5317086c41798469d0868535943a",
    "creator_name" : "Big beta test account",
    "executor_id" : "847a5317086c41798469d0868535943a",
    "executor_name" : "Big beta test account",
    "start_time" : "2022-09-08 16:52:03",
    "create_time" : "2020-10-29 17:05:02",
    "watched" : "true"
  } ]
}

SDK Sample Code

The SDK sample code is as follows.

This API is used to obtain the pipeline list. Example: The project ID is e12ed176898d4841aa9881fe9b933c87 and the creator ID is 847a5317086c41798469d0868535943a. Pipelines are sorted by pipeline name in descending order.

 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
51
52
53
54
55
56
57
58
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.codeartspipeline.v2.region.CodeArtsPipelineRegion;
import com.huaweicloud.sdk.codeartspipeline.v2.*;
import com.huaweicloud.sdk.codeartspipeline.v2.model.*;


public class ListPipelineSimpleInfoSolution {

    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");

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        CodeArtsPipelineClient client = CodeArtsPipelineClient.newBuilder()
                .withCredential(auth)
                .withRegion(CodeArtsPipelineRegion.valueOf("<YOUR REGION>"))
                .build();
        ListPipelineSimpleInfoRequest request = new ListPipelineSimpleInfoRequest();
        ListPipelineSimpleInfoRequestBody body = new ListPipelineSimpleInfoRequestBody();
        body.withLimit(10);
        body.withOffset(4);
        body.withGitUrl("");
        body.withSortDir("desc");
        body.withSortKey("pipeline_name");
        body.withOutcome("error,success,aborted");
        body.withStatus("waiting,running,verifying,handling,suspending,completed");
        body.withExecutorIds("847a5317086c41798469d0868535943a");
        body.withCreatorIds("847a5317086c41798469d0868535943a");
        body.withProjectIds("e12ed176898d4841aa9881fe9b933c87");
        body.withPipelineName("");
        request.withBody(body);
        try {
            ListPipelineSimpleInfoResponse response = client.listPipelineSimpleInfo(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());
        }
    }
}

This API is used to obtain the pipeline list. Example: The project ID is e12ed176898d4841aa9881fe9b933c87 and the creator ID is 847a5317086c41798469d0868535943a. Pipelines are sorted by pipeline name in descending order.

 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
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcodeartspipeline.v2.region.codeartspipeline_region import CodeArtsPipelineRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcodeartspipeline.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"]

    credentials = BasicCredentials(ak, sk)

    client = CodeArtsPipelineClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CodeArtsPipelineRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListPipelineSimpleInfoRequest()
        request.body = ListPipelineSimpleInfoRequestBody(
            limit=10,
            offset=4,
            git_url="",
            sort_dir="desc",
            sort_key="pipeline_name",
            outcome="error,success,aborted",
            status="waiting,running,verifying,handling,suspending,completed",
            executor_ids="847a5317086c41798469d0868535943a",
            creator_ids="847a5317086c41798469d0868535943a",
            project_ids="e12ed176898d4841aa9881fe9b933c87",
            pipeline_name=""
        )
        response = client.list_pipeline_simple_info(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

This API is used to obtain the pipeline list. Example: The project ID is e12ed176898d4841aa9881fe9b933c87 and the creator ID is 847a5317086c41798469d0868535943a. Pipelines are sorted by pipeline name in descending order.

 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
51
52
53
54
55
56
57
58
59
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    codeartspipeline "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/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")

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := codeartspipeline.NewCodeArtsPipelineClient(
        codeartspipeline.CodeArtsPipelineClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListPipelineSimpleInfoRequest{}
	limitListPipelineSimpleInfoRequestBody:= int32(10)
	offsetListPipelineSimpleInfoRequestBody:= int32(4)
	gitUrlListPipelineSimpleInfoRequestBody:= ""
	sortDirListPipelineSimpleInfoRequestBody:= "desc"
	sortKeyListPipelineSimpleInfoRequestBody:= "pipeline_name"
	outcomeListPipelineSimpleInfoRequestBody:= "error,success,aborted"
	statusListPipelineSimpleInfoRequestBody:= "waiting,running,verifying,handling,suspending,completed"
	executorIdsListPipelineSimpleInfoRequestBody:= "847a5317086c41798469d0868535943a"
	creatorIdsListPipelineSimpleInfoRequestBody:= "847a5317086c41798469d0868535943a"
	projectIdsListPipelineSimpleInfoRequestBody:= "e12ed176898d4841aa9881fe9b933c87"
	pipelineNameListPipelineSimpleInfoRequestBody:= ""
	request.Body = &model.ListPipelineSimpleInfoRequestBody{
		Limit: &limitListPipelineSimpleInfoRequestBody,
		Offset: &offsetListPipelineSimpleInfoRequestBody,
		GitUrl: &gitUrlListPipelineSimpleInfoRequestBody,
		SortDir: &sortDirListPipelineSimpleInfoRequestBody,
		SortKey: &sortKeyListPipelineSimpleInfoRequestBody,
		Outcome: &outcomeListPipelineSimpleInfoRequestBody,
		Status: &statusListPipelineSimpleInfoRequestBody,
		ExecutorIds: &executorIdsListPipelineSimpleInfoRequestBody,
		CreatorIds: &creatorIdsListPipelineSimpleInfoRequestBody,
		ProjectIds: &projectIdsListPipelineSimpleInfoRequestBody,
		PipelineName: &pipelineNameListPipelineSimpleInfoRequestBody,
	}
	response, err := client.ListPipelineSimpleInfo(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

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

401

Unauthorized

403

Forbidden

404

Not Found

Error Codes

See Error Codes.