分页查询构建归档包列表 - ListFileBuildArchives
功能介绍
分页查询构建归档包列表
调用方法
请参见如何调用API。
授权信息
账号根用户具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备如下身份策略权限,更多的权限说明请参见权限和授权项。
| 授权项 | 访问级别 | 资源类型(*为必须) | 条件键 | 别名 | 依赖的授权项 |
|---|---|---|---|---|---|
| codeartsartifact:releaseRepo:read | Read | - | - | - | - |
URI
GET /devreposerver/v5/files/archives
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| parent_id | 否 | String | 参数解释: 文件ID。使用查询文件/项目列表接口查询文件信息的响应体中"id"参数的值作为文件ID的值。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
| build_id | 否 | String | 参数解释: 构建任务ID。请从CodeArts编译构建中查询。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
| build_no | 否 | String | 参数解释: 构建任务序号。请从CodeArts编译构建中查询。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
| page_no | 否 | Integer | 参数解释: 页码。 约束限制: (page_no - 1) * page_size < 2147483647。 取值范围: 1-2147483647。 默认取值: 1。 |
| page_size | 否 | Integer | 参数解释: 每页大小。 约束限制: (page_no - 1) * page_size < 2147483647。 取值范围: 1-100。 默认取值: 10。 |
| repo_branch | 否 | String | 参数解释: codehub仓库分支。请从codehub中查询。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| x-auth-token | 是 | String | 参数解释: 用户token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值),调用详情请参考章节。 约束限制: 不涉及。 取值范围: 字符串长度为1-100000。 默认取值: 不涉及。 |
响应参数
状态码:200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| status | String | 参数解释: 请求成功或失败状态。 取值范围: |
| trace_id | String | 参数解释: 请求id,当前请求的唯一标识。 取值范围: 数字及中划线(-)组成的字符串。 |
| result | ListFileBuildArchivesResVo object | 参数解释: 查询构建归档包结果。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| data | Array of data objects | 参数解释: 构建归档包列表。 |
| totalRecords | Integer | 参数解释: 结果总数量。 取值范围: 不涉及。 |
| totalPages | Integer | 参数解释: 结果总页数。 取值范围: 不涉及。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| domainId | String | 参数解释: 租户id。 取值范围: 不涉及。 |
| region | String | 参数解释: 区域。 取值范围: 不涉及。 |
| createdTime | String | 参数解释: 创建时间。 取值范围: 不涉及。 |
| createdUserId | String | 参数解释: 创建人id。 取值范围: 不涉及。 |
| buildId | String | 参数解释: 构建id。 取值范围: 不涉及。 |
| buildName | String | 参数解释: 构建任务名称。 取值范围: 不涉及。 |
| buildNo | String | 参数解释: 构建序号。 取值范围: 不涉及。 |
| buildVersion | String | 参数解释: 构建版本。 取值范围: 不涉及。 |
| buildUrl | String | 参数解释: 构建任务链接。 取值范围: 不涉及。 |
| repoUrl | String | 参数解释: 构建代码仓地址。 取值范围: 不涉及。 |
| repoBranch | String | 参数解释: 构建分支。 取值范围: 不涉及。 |
| commitId | String | 参数解释: 构建commit id。 取值范围: 不涉及。 |
| projectId | String | 参数解释: 项目id。 取值范围: 不涉及。 |
| fileId | String | 参数解释: 文件id。 取值范围: 不涉及。 |
| repoName | String | 参数解释: 制品仓库名称。 取值范围: 不涉及。 |
| parentId | String | 参数解释: 父文件id。 取值范围: 不涉及。 |
| fileName | String | 参数解释: 文件名称。 取值范围: 不涉及。 |
| size | Long | 参数解释: 文件大小。 取值范围: 不涉及。 |
| md5 | String | 参数解释: 文件md5值。 取值范围: 不涉及。 |
| sha256 | String | 参数解释: 文件sha256值。 取值范围: 不涉及。 |
| downloadUrlWithId | String | 参数解释: 下载地址。 取值范围: 不涉及。 |
| webUrl | String | 参数解释: 该参数已废弃,请忽略。 取值范围: 不涉及。 |
| versionEnable | Boolean | 参数解释: 是否version层文件夹(第一层文件夹下可以放版本文件夹)。 取值范围: |
| migratedState | Integer | 参数解释: 迁移标记。 取值范围: 不涉及。 |
| repoFilePath | String | 参数解释: 构建归档文件存储路径。 取值范围: 不涉及。 |
| repoSameTrashFileName | String | 参数解释: 回收站历史同名文件名称。 取值范围: 不涉及。 |
| created_user_name | String | 参数解释: 创建人名称。 取值范围: 不涉及。 |
| secret_type | String | 参数解释: 仓库密级等级。 取值范围: 从"租户设置"->"全局设置"->"可见信息密级"的设置页面接口GET https://{endpoint}/projects/v1/options的响应参数中获取,其中的code值即为密级等级。 |
请求示例
https://artifact.example-1.com/devreposerver/v5/files/archives?build_id=66666603da854239ab51209ea7e27b64&repo_branch=master&parent_id=66666687399849b782b13c9512fbb3b6
响应示例
状态码: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代码示例
SDK代码示例如下。
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 36 37 38 39 40 41 42 43 44 45 46 47 | 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, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := codeartsartifact.CodeArtsArtifactClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := codeartsartifact.NewCodeArtsArtifactClient(hcClient) request := &model.ListFileBuildArchivesRequest{} response, err := client.ListFileBuildArchives(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
| 状态码 | 描述 |
|---|---|
| 200 | OK |
错误码
请参见错误码。