Querying Template List
Function
This API is used to query the pipeline template list.
Calling Method
For details, see Calling APIs.
URI
POST /v5/{tenant_id}/api/pipeline-templates/list
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tenant_id |
Yes |
String |
Parameter description: Tenant ID. Constraints: None. Value range: 32 characters, including only digits and letters. Default value: None. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
language |
No |
String |
Parameter description: Template language. Constraints: N/A Value range: The options include Java, Python, Node.js, Go, .NET, CPP, PHP, other, and none. Default value: N/A |
is_system |
No |
Boolean |
Parameter description: Whether the template is a system template. Constraints: N/A Value range: true: a system template; false: not a system template. Default value: N/A |
name |
No |
String |
Parameter description: Template name. Constraints: None. Value range: None. Default value: None. |
offset |
No |
Long |
Parameter description: Offset, which is the position where the query starts. Constraints: None. Value range: The value is no less than 0. Default value: The default value is 0. |
limit |
No |
Long |
Parameter description: Number of items queried each time. Constraints: None. Value range: None. Default value: 10. |
sort_key |
No |
String |
Parameter description: (Optional) Field for sorting. Constraints: N/A Value range: The value can be name or create_time. Default value: N/A |
sort_dir |
No |
String |
Parameter description: (Optional) Sorting type. Constraints: None. Value range: asc: Ascending; desc: Descending. Default value: None. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
offset |
Integer |
Parameter description: Initial offset. Value range: None. |
limit |
Integer |
Parameter description: Number of queried records. Value range: None. |
total |
Integer |
Parameter description: Total number of records. Value range: None. |
templates |
Array of PipelineTemplateSimpleVO objects |
Parameter description: Pipeline template list, including details about pipeline templates. Value Range: N/A. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Parameter description: Template ID. Value range: 32 characters. |
name |
String |
Parameter description: Template name. Value range: None. |
icon |
String |
Parameter description: Template icon. Value range: None. |
manifest_version |
String |
Parameter description: Version. Value range: The default value is 3.0. |
language |
String |
Parameter description: Template language. Value range: The options include Java, Python, Node.js, Go, .NET, CPP, PHP, other, and none. |
description |
String |
Parameter description: Template description. Value range: None. |
is_system |
Boolean |
Parameter description: Whether the template is a system template. Value Range: The value can be "true" or "false". |
region |
String |
Parameter description: Template region. Value range: None. |
domain_id |
String |
Parameter description: ID of the tenant to which the template belongs. Value range: 32 characters. |
creator_id |
String |
Parameter description: Template creator ID. Value range: 32 characters. |
creator_name |
String |
Parameter description: Template creator name. Value range: None. |
updater_id |
String |
Parameter description: ID of the user who updates the template. Value range: 32 characters. |
create_time |
Integer |
Parameter description: Creation time. Value range: None. |
update_time |
Integer |
Parameter description: Update time. Value range: None. |
is_collect |
Boolean |
Parameter description: Whether to add a template to favorites. Value Range: The value can be "true" or "false". |
is_show_source |
String |
Parameter description: Whether to display the pipeline source. Value Range: The value can be "true" or "false". |
stages |
Array of stages objects |
Parameter description: Stages of template orchestration. Constraints: N/A |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Parameter description: Stage name. Value range: Enter only letters, digits, hyphens (-), underscores (_), commas (,), semicolons (;), colons (:), periods (.), slashes (/), parentheses (), and spaces. The name cannot start or end with a space, and the length is 1128 characters. |
sequence |
Integer |
Parameter description: Stage sequence. Value range: No less than 0. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_msg |
String |
Parameter description: Error message. Value range: N/A |
error_code |
String |
Parameter description: Error code. Value range: N/A |
Example Requests
This API is used to query the pipeline template list.
Set the start offset to 0 and the number to 3.
POST https://{endpoint}/v5/a5f63758220947b7821e70ae2734c01d/api/pipeline-templates/list
{
"is_system" : "",
"offset" : 0,
"limit" : 3,
"name" : ""
}
Example Responses
Status code: 200
OK
{
"offset" : 0,
"limit" : 3,
"total" : 19,
"templates" : [ {
"id" : "e908740fe06e44a28f30c0f3c81b2ad5",
"name" : "Serverless-maven Compilation and Deployment",
"icon" : "maven60",
"manifest_version" : "3.0",
"language" : "Java",
"description" : "Serverless-maven compilation and building, packaging, and deployment templates",
"is_system" : true,
"region" : "system",
"domain_id" : "system",
"creator_id" : "system",
"creator_name" : "system",
"updater_id" : "e908740fe06e44a28f30c0f3c81b2ad5",
"create_time" : 1671172288000,
"update_time" : 1677640980000,
"is_collect" : true,
"is_show_source" : null,
"stages" : [ {
"name" : "Build and Check",
"sequence" : 0
}, {
"name" : "Deployment and Test",
"sequence" : 1
} ]
}, {
"id" : "ac3b3b9a6cb64ef6b732c8f8459ab578",
"name" : "Building a Container Image on a Node",
"icon" : "npm60",
"manifest_version" : "3.0",
"language" : "Node.js",
"description" : "Use nodes to build container images and push them to SWR for storage.",
"is_system" : true,
"region" : "system",
"domain_id" : "system",
"creator_id" : "system",
"creator_name" : "system",
"updater_id" : "ac3b3b9a6cb64ef6b732c8f8459ab578",
"create_time" : 1671172288000,
"update_time" : 1677640980000,
"is_collect" : true,
"is_show_source" : null,
"stages" : [ {
"name" : "Build",
"sequence" : 0
} ]
}, {
"id" : "8ea4d170ba0d45d9b1b647a9780ebcf8",
"name" : "Getting Started",
"icon" : null,
"manifest_version" : "3.0",
"language" : "java",
"description" : "Pipeline Template for Beginners",
"is_system" : true,
"region" : "system",
"domain_id" : "system",
"creator_id" : "system",
"creator_name" : "system",
"updater_id" : "ac3b3b9a6cb64ef6b732c8f8459ab578",
"create_time" : 1680769082000,
"update_time" : 1680770243000,
"is_collect" : false,
"is_show_source" : null,
"stages" : [ {
"name" : "Code check",
"sequence" : 0
}, {
"name" : "Build Phase",
"sequence" : 1
}, {
"name" : "Deployment and Release",
"sequence" : 2
} ]
} ]
}
SDK Sample Code
The SDK sample code is as follows.
This API is used to query the pipeline template list.
Set the start offset to 0 and the number to 3.
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 |
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 ListPipelineTemplatesSolution {
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();
ListPipelineTemplatesRequest request = new ListPipelineTemplatesRequest();
request.withTenantId("{tenant_id}");
ListPipelineTemplatesQuery body = new ListPipelineTemplatesQuery();
body.withLimit(3L);
body.withOffset(0L);
body.withName("");
body.withIsSystem();
request.withBody(body);
try {
ListPipelineTemplatesResponse response = client.listPipelineTemplates(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 query the pipeline template list.
Set the start offset to 0 and the number to 3.
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 |
# 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 = ListPipelineTemplatesRequest()
request.tenant_id = "{tenant_id}"
request.body = ListPipelineTemplatesQuery(
limit=3,
offset=0,
name="",
is_system=
)
response = client.list_pipeline_templates(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 query the pipeline template list.
Set the start offset to 0 and the number to 3.
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 |
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.ListPipelineTemplatesRequest{}
request.TenantId = "{tenant_id}"
limitListPipelineTemplatesQuery:= int64(3)
offsetListPipelineTemplatesQuery:= int64(0)
nameListPipelineTemplatesQuery:= ""
isSystemListPipelineTemplatesQuery:=
request.Body = &model.ListPipelineTemplatesQuery{
Limit: &limitListPipelineTemplatesQuery,
Offset: &offsetListPipelineTemplatesQuery,
Name: &nameListPipelineTemplatesQuery,
IsSystem: &isSystemListPipelineTemplatesQuery,
}
response, err := client.ListPipelineTemplates(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.
This API is used to query the pipeline template list.
Set the start offset to 0 and the number to 3.
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 |
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 ListPipelineTemplatesSolution {
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();
ListPipelineTemplatesRequest request = new ListPipelineTemplatesRequest();
request.withTenantId("{tenant_id}");
ListPipelineTemplatesQuery body = new ListPipelineTemplatesQuery();
body.withLimit(3L);
body.withOffset(0L);
body.withName("");
body.withIsSystem();
request.withBody(body);
try {
ListPipelineTemplatesResponse response = client.listPipelineTemplates(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 query the pipeline template list.
Set the start offset to 0 and the number to 3.
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 |
# 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 = ListPipelineTemplatesRequest()
request.tenant_id = "{tenant_id}"
request.body = ListPipelineTemplatesQuery(
limit=3,
offset=0,
name="",
is_system=
)
response = client.list_pipeline_templates(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 query the pipeline template list.
Set the start offset to 0 and the number to 3.
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 |
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.ListPipelineTemplatesRequest{}
request.TenantId = "{tenant_id}"
limitListPipelineTemplatesQuery:= int64(3)
offsetListPipelineTemplatesQuery:= int64(0)
nameListPipelineTemplatesQuery:= ""
isSystemListPipelineTemplatesQuery:=
request.Body = &model.ListPipelineTemplatesQuery{
Limit: &limitListPipelineTemplatesQuery,
Offset: &offsetListPipelineTemplatesQuery,
Name: &nameListPipelineTemplatesQuery,
IsSystem: &isSystemListPipelineTemplatesQuery,
}
response, err := client.ListPipelineTemplates(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.
Feedback
Was this page helpful?
Provide feedbackThank 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