文档首页/ 华为云UCS/ API参考/ API/ 配置管理/ 获取仓库源列表 - ListRepos
更新时间:2025-11-17 GMT+08:00
分享

获取仓库源列表 - ListRepos

功能介绍

获取仓库源列表

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项

URI

GET /v1/configsets/repos

表1 Query参数

参数

是否必选

参数类型

描述

clusterid

String

集群id

limit

Integer

分页获取列表时,页的大小,默认为-1

offset

String

分页获取列表时,起始偏移量,默认为0

order_by

String

分页获取列表时,排序参数,支持create_at和update_at,默认create_at:

  • create_at:按创建时间排序

  • update_at:按更新时间排序

order

String

分页获取列表时,排序方向,支持desc和asc,默认desc:

  • desc:降序排序

  • asc:升序排序

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

身份认证信息,调用接口的认证方式分为Token和AK/SK两种,如果您使用的Token方式,此参数为必填,请填写Token的值

响应参数

状态码:200

表3 响应Body参数

参数

参数类型

描述

items

Array of RepoResponse objects

仓库源信息列表

total

Integer

所有页的结果的总数

表4 RepoResponse

参数

参数类型

描述

uid

String

仓库的唯一标识符

name

String

仓库名称

repoType

String

仓库类型,包括Bucket、HelmChart、GitRepository、HelmRepository,目前仅支持GitRepository

namespace

String

命名空间

gitRepository

GitRepository object

Git仓库信息

repoStatus

String

仓库状态,包括Health、Failed、Unknown、Progressing

clusterInfo

ClusterInfo object

集群基本信息

secretInfo

SecretInfo object

访问仓库的认证信息

表5 GitRepository

参数

参数类型

描述

metadata

GitRepositoryMetaData object

资源的元数据

spec

GitRepositorySpec object

Git仓库的配置信息

status

GitRepositoryStatus object

Git仓库的状态

表6 GitRepositoryMetaData

参数

参数类型

描述

name

String

仓库名称

namespace

String

所属命名空间

uid

String

唯一标识符

resourceVersion

String

资源的内部版本标识,用于并发控制

generation

Integer

资源的期望状态的代数,每次修改spec会自增

creationTimestamp

String

创建时间

finalizers

Array of strings

删除前需要执行的清理操作

managedFields

Array of ManagedFieldsEntry objects

用于跟踪资源字段管理权,记录每个字段的管理者

表7 ManagedFieldsEntry

参数

参数类型

描述

manager

String

管理者的名称

operation

String

记录导致此条目创建的操作类型,只能是 Apply 或 Update 两种操作类型

apiVersion

String

该管理者定义字段时所依据的资源 API 版本

time

String

此管理条目被创建或最后一次更新的时间戳

fieldsType

String

固定为 "FieldsV1",标记字段结构格式

fieldsV1

Object

用于存储实际被管理的字段信息

表8 GitRepositorySpec

参数

参数类型

描述

url

String

Git仓库地址

ref

GitRepositoryRef object

用于指定要解析和检出的Git引用

secretRef

LocalObjectReference object

包含认证信息的Secret

interval

String

周期性检查仓库更新的时间间隔,格式如 "1m" 表示1分钟

timeout

String

Git 操作(如克隆)的超时时间,默认60秒

表9 GitRepositoryRef

参数

参数类型

描述

branch

String

用于指定要检出的Git分支。如果未定义其他字段,则默认检出'master'分支。

表10 LocalObjectReference

参数

参数类型

描述

name

String

被引用资源的名称

表11 GitRepositoryStatus

参数

参数类型

描述

observedGeneration

Integer

控制器上次处理的GitRepository版本号

conditions

Array of objects

GitRepository当前的条件集合,用于表示对象的不同状态

artifact

Artifact object

最近一次成功协调生成的制品

表12 Artifact

参数

参数类型

描述

path

String

制品的相对文件路径

url

String

HTTP地址,可通过该地址下载或访问制品内容

revision

String

版本标识符

digest

String

文件摘要,格式为 <算法>:<校验值>

lastUpdateTime

String

最后更新时间

size

Integer

文件大小(以字节为单位)

表13 ClusterInfo

参数

参数类型

描述

clusterID

String

集群ID

clusterName

String

集群名称

clusterPath

String

集群路径

表14 SecretInfo

参数

参数类型

描述

authMode

String

使用的认证模式

secret

Object

存储了实际认证凭据的Secret

状态码:400

表15 响应Body参数

参数

参数类型

描述

-

String

状态码:403

表16 响应Body参数

参数

参数类型

描述

-

String

状态码:500

表17 响应Body参数

参数

参数类型

描述

-

String

请求示例

响应示例

状态码:200

获取到的仓库源详细信息

{
  "items" : [ {
    "name" : "official-podinfo-repo-06",
    "repoType" : "GitRepository",
    "namespace" : "default",
    "gitRepository" : {
      "metadata" : {
        "name" : "official-podinfo-repo-06",
        "namespace" : "default",
        "uid" : "2ee7be10-8a01-4f10-ae85-e84dd46146eb",
        "resourceVersion" : "726499",
        "generation" : 1,
        "creationTimestamp" : "2023-03-16T07:58:56Z",
        "finalizers" : [ "finalizers.fluxcd.io" ],
        "managedFields" : [ {
          "manager" : "Go-http-client",
          "operation" : "Update",
          "apiVersion" : "source.toolkit.fluxcd.io/v1beta2",
          "time" : "2023-03-16T07:58:56Z",
          "fieldsType" : "FieldsV1",
          "fieldsV1" : {
            "f:spec" : {
              "." : { },
              "f:gitImplementation" : { },
              "f:interval" : { },
              "f:ref" : {
                "." : { },
                "f:branch" : { }
              },
              "f:secretRef" : {
                "." : { },
                "f:name" : { }
              },
              "f:timeout" : { },
              "f:url" : { }
            }
          }
        }, {
          "manager" : "source-controller",
          "operation" : "Update",
          "apiVersion" : "source.toolkit.fluxcd.io/v1beta2",
          "time" : "2023-03-16T07:59:12Z",
          "fieldsType" : "FieldsV1",
          "fieldsV1" : {
            "f:metadata" : {
              "f:finalizers" : {
                "." : { },
                "v:\"finalizers.fluxcd.io\"" : { }
              }
            },
            "f:status" : {
              "f:conditions" : { }
            }
          }
        } ]
      },
      "spec" : {
        "url" : "https://github.com/GitHubxsy/podinfo",
        "secretRef" : {
          "name" : "https-ca-credentials"
        },
        "interval" : "1m0s",
        "timeout" : "1m0s",
        "ref" : {
          "branch" : "master"
        }
      },
      "status" : {
        "observedGeneration" : -1,
        "conditions" : [ {
          "type" : "Reconciling",
          "status" : "True",
          "observedGeneration" : 1,
          "lastTransitionTime" : "2023-03-16T07:58:56Z",
          "reason" : "NoArtifact",
          "message" : "no artifact for resource in storage"
        }, {
          "type" : "Ready",
          "status" : "False",
          "observedGeneration" : 1,
          "lastTransitionTime" : "2023-03-16T08:14:23Z",
          "reason" : "GitOperationFailed",
          "message" : "failed to checkout and determine revision: unable to fetch-connect to remote 'https://github.com/GitHubxsy/podinfo': Get \"https://github.com/GitHubxsy/podinfo/info/refs?service=git-upload-pack\": dial tcp: lookup github.com on 10.247.3.10:53: read udp 172.17.0.16:60193->10.247.3.10:53: i/o timeout"
        }, {
          "type" : "FetchFailed",
          "status" : "True",
          "observedGeneration" : 1,
          "lastTransitionTime" : "2023-03-16T08:14:23Z",
          "reason" : "GitOperationFailed",
          "message" : "failed to checkout and determine revision: unable to fetch-connect to remote 'https://github.com/GitHubxsy/podinfo': Get \"https://github.com/GitHubxsy/podinfo/info/refs?service=git-upload-pack\": dial tcp: lookup github.com on 10.247.3.10:53: read udp 172.17.0.16:60193->10.247.3.10:53: i/o timeout"
        } ]
      }
    },
    "clusterInfo" : { },
    "secretInfo" : { }
  } ],
  "total" : 1
}

状态码

状态码

描述

200

获取到的仓库源详细信息

400

客户端请求错误,服务器无法执行请求

403

服务器拒绝执行请求

500

服务器内部错误

错误码

请参见错误码

相关文档