
# 获取当前项目下所有企业仓库实例的仓库列表 - ListAllInstanceRepositories
#### 功能介绍
获取当前项目下所有企业仓库实例的仓库列表，不包含共享企业仓库实例下的仓库
#### 接口约束
无
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-swr2/swr_02_0002.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-swr2/swr_02_0131.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
  
  | 授权项                                        | 访问级别 | 资源类型（\*为必须）   | 条件键                                                                                                                                                                                                                                                                                                                 | 别名 | 依赖的授权项 |
  |:---|:---|:---|:---|:---|:---|
  | swr:repository:listAllInstanceRepositories | List | repository \* | - g:ResourceTag/\<tag-key\>   - g:EnterpriseProjectId    | -  | -      |
     
  
 
#### URI
GET /v2/{project_id}/repositories
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述   |
|:---|:---|:---|:---|
| project_id | 是    | String | 项目ID |
   
表2Query参数 
| 参数     | 是否必选 | 参数类型    | 描述                                                                           |
|:---|:---|:---|:---|
| marker | 否    | String  | 分页查询时的查询标记，使用上一次接口调用返回的next_marker值，默认值从第一条数据查询。**注意：marker和limit参数需要配套使用。** |
| limit  | 否    | Integer | 条目数量，用于分页查询，默认值为100，最大值为100                                                  |
| name   | 否    | String  | 仓库名称                                                                         |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。 通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数           | 参数类型                                                                             | 描述     |
|:---|:---|:---|
| page_info    | [PageInfo] object                               | 分页信息   |
| repositories | Array of [InstanceRepository] objects | 仓库列表详情 |
   
 表5PageInfo 
| 参数          | 参数类型   | 描述                              |
|:---|:---|:---|
| next_marker | String | 下一次分页查询的起始标记。如果未返回该值，则表示数据已查询完毕 |
   
 表6InstanceRepository 
| 参数             | 参数类型                                                               | 描述                                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|
| id             | Integer                                                            | 仓库ID                                                                                                                                                                                                                                                                                                       |
| name           | String                                                             | 仓库名称                                                                                                                                                                                                                                                                                                       |
| namespace_name | String                                                             | 命名空间名称                                                                                                                                                                                                                                                                                                     |
| namespace_id   | Integer                                                            | 命名空间ID                                                                                                                                                                                                                                                                                                     |
| tag_count      | Integer                                                            | 仓库内的制品版本数量                                                                                                                                                                                                                                                                                                 |
| pull_count     | Integer                                                            | 被下载总次数                                                                                                                                                                                                                                                                                                     |
| artifact_count | Integer                                                            | 制品包总数                                                                                                                                                                                                                                                                                                      |
| description    | String                                                             | 描述                                                                                                                                                                                                                                                                                                         |
| created_at     | String                                                             | 创建时间                                                                                                                                                                                                                                                                                                       |
| updated_at     | String                                                             | 更新时间                                                                                                                                                                                                                                                                                                       |
| tags           | Array of [ResourceTag] objects | 标签列表                                                                                                                                                                                                                                                                                                       |
| instance_id    | String                                                             | 企业仓库实例ID                                                                                                                                                                                                                                                                                                   |
| instance_name  | String                                                             | 企业仓库实例名称                                                                                                                                                                                                                                                                                                   |
| resource_urn   | String                                                             | 资源URN的值，格式为：swr:\[/topic/body/section/table/tgroup/tbody/row/entry/p/br {""}) (br\]:\[/topic/body/section/table/tgroup/tbody/row/entry/p/br {""}) (br\]:repository:\[/topic/body/section/table/tgroup/tbody/row/entry/p/br {""}) (br\]/\[/topic/body/section/table/tgroup/tbody/row/entry/p/br {""}) (br\] |
   
 表7ResourceTag 
| 参数    | 参数类型   | 描述                        |
|:---|:---|:---|
| key   | String | 标签键，最大长度128个unicode字符。    |
| value | String | 标签值，每个值最大长度255个unicode字符。 |
   
#### 请求示例
```
GET https://{endpoint}/v2/{project_id}/repositories
```
#### 响应示例
**状态码：200**
查询仓库列表成功
```
{
  "repositories" : [ {
    "tag_count" : 1,
    "created_at" : "2020-09-19T01:39:58.326Z",
    "description" : "test",
    "id" : 158,
    "name" : "ccccc/test",
    "namespace_id" : 36,
    "pull_count" : 12,
    "artifact_count" : 12,
    "updated_at" : "2020-10-27T07:28:04.051Z",
    "instance_id" : "xx-xx-xx-xx",
    "instance_name" : "test",
    "resource_urn" : "swr:cn-north-4:xxxx:repository:test-swr/swr-test-1215/test2"
  } ],
  "page_info" : {
    "next_marker" : "xxx"
  }
}
```
#### 状态码
| 状态码 | 描述       |
|:---|:---|
| 200 | 查询仓库列表成功 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-swr2/ErrorCode.html)。
