Querying the Build Archive Package List by Page
Function
This API is used to query the build archive package list by page.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
|
Action |
Access Level |
Resource Type (*: required) |
Condition Key |
Alias |
Dependencies |
|---|---|---|---|---|---|
|
codeartsartifact:releaseRepo:read |
Read |
- |
- |
- |
- |
URI
GET /devreposerver/v5/files/archives
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
parent_id |
No |
String |
Parent node ID. |
|
build_id |
No |
String |
Build ID. |
|
build_no |
No |
String |
Build No. |
|
page_no |
No |
Integer |
Number of pages. |
|
page_size |
No |
Integer |
Number of records on each page. |
|
repo_branch |
No |
String |
CodeHub repository branch. |
Request Parameters
None
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
status |
String |
Definition Request status. Range success: The request is successful. error: The request fails. |
|
trace_id |
String |
Definition Request ID, which uniquely identifies the current request. Range A string of digits and hyphens (-). |
|
result |
Object |
Definition Response of the request. The return value varies according to the API. Range The value range varies according to the API. |
Example Requests
https://localhost.com/devreposerver/v5/files/archives?build_id=66666603da854239ab51209ea7e27b64&repo_branch=master&parent_id=66666687399849b782b13c9512fbb3b6
Example Responses
Status code: 200
OK
{
"status" : "success",
"trace_id" : "76629-1718767414372-27337",
"result" : {
"data" : [ {
"domainId" : "09d2ca2f5080d5b60f51c00ae5666666",
"region" : "region",
"createdTime" : "2024-02-27 18:29:19",
"createdUserId" : "09d2ca2ffd00d3c21ff8c00a4d666666",
"createdUserName" : "test-user",
"buildId" : "11236703da854239ab51209ea7666666",
"buildName" : "maven1-23414517",
"buildNo" : "20240227.3",
"buildVersion" : "20240227.3",
"buildUrl" : "https://localhost.com/codeci/project/1bbbdd388234492793eb1bf59e666666/codeci/detail/workspace/11236703da854239ab51209ea7666666/3",
"repoUrl" : "",
"repoBranch" : "master",
"commitId" : "66666683c1590363818225ec649d7cf161f0d49c",
"projectId" : "1bbbdd388234492793eb1bf59e666666",
"fileId" : "666666f9d76f405a8d503b841de02b51",
"repoName" : "region_1bbbdd388234492793eb1bf59e666666_generic_0",
"parentId" : "66666687399849b782b13c9512fbb3b6",
"fileName" : "HelloWorld.class",
"size" : 534,
"md5" : "e06fcae2912a318db12955f37cd9230b",
"sha256" : "96f5666537da969efee5f51f2969771b3743ada63fde57e42ad210c116ceedaf",
"downloadUrlWithId" : "https://localhost.com/DevRepoServer/v1/files/download?file_id=666666f9d76f405a8d503b841de02b51&type=archive",
"webUrl" : "https://localhost.com/cloudartifact/project/1bbbdd388234492793eb1bf59e666666/private/general?parentId=66666687399849b782b13c9512fbb3b6",
"versionEnable" : false,
"migratedState" : 2,
"repoSameTrashFileName" : "trash_e653c9f9d76f405a8d503b841666666"
} ],
"totalRecords" : 1,
"totalPages" : 1
}
}
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 |
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.codeartsartifact.v2.region.CodeArtsArtifactRegion; import com.huaweicloud.sdk.codeartsartifact.v2.*; import com.huaweicloud.sdk.codeartsartifact.v2.model.*; public class ListFileBuildArchivesSolution { 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); CodeArtsArtifactClient client = CodeArtsArtifactClient.newBuilder() .withCredential(auth) .withRegion(CodeArtsArtifactRegion.valueOf("<YOUR REGION>")) .build(); ListFileBuildArchivesRequest request = new ListFileBuildArchivesRequest(); try { ListFileBuildArchivesResponse response = client.listFileBuildArchives(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 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkcodeartsartifact.v2.region.codeartsartifact_region import CodeArtsArtifactRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcodeartsartifact.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 = CodeArtsArtifactClient.new_builder() \ .with_credentials(credentials) \ .with_region(CodeArtsArtifactRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListFileBuildArchivesRequest() response = client.list_file_build_archives(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 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" codeartsartifact "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsartifact/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsartifact/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsartifact/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 := codeartsartifact.NewCodeArtsArtifactClient( codeartsartifact.CodeArtsArtifactClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListFileBuildArchivesRequest{} response, err := client.ListFileBuildArchives(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 |
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