本文档概述了如何按完整或部分代码库 ID 搜索和查看 Secure Source Manager 代码库。
所需的角色
如需获得搜索代码库所需的权限,请让您的管理员为您授予以下 IAM 角色:
-
Secure Source Manager Instance Accessor (
roles/securesourcemanager.instanceAccessor
) 在 Secure Source Manager 实例上 -
Secure Source Manager Repo Reader (
roles/securesourcemanager.repoReader
) 在您要搜索的代码库上
如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
如需了解如何授予 Secure Source Manager 角色,请参阅使用 IAM 进行访问权限控制和向用户授予实例访问权限。
列出代码库
网页界面
如需通过网页界面访问 Secure Source Manager 实例,请将以下网址复制到浏览器地址栏中。
INSTANCE_ID-PROJECT_NUMBER.LOCATION.sourcemanager.dev
替换以下内容:
- 将 INSTANCE_ID 替换为实例名称。
- 将 PROJECT_NUMBER 替换为实例的 Google Cloud项目编号。如需了解如何标识项目,请参阅标识项目。
- 将 LOCATION 替换为实例的区域。
我的代码库标签页会显示您有权查看的所有代码库。
API
如需列出实例中给定区域的所有代码库的详细信息,请使用以下 HTTP 方法和网址。
在使用任何请求数据之前,请先进行以下替换:
- PROJECT_ID:运行 Secure Source Manager 的 Google Cloud 项目的项目 ID。
- INSTANCE_ID:实例 ID。
- LOCATION:实例所在的区域。如需了解支持的位置,请参阅位置。
HTTP 方法和网址:
GET https://securesourcemanager.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/repositories?instance=projects/PROJECT_ID/locations/LOCATION/instances/INSTANCE_ID
如需发送您的请求,请展开以下选项之一:
您应该收到类似以下内容的 JSON 响应:
{ "repositories" : [ { "createTime" : "2023-08-09T19:32:15Z", "instance" : "projects/012345678901/locations/us-central1/instances/my-instance", "name" : "projects/my-project/locations/us-central1/repositories/my-repo", "uris" : { "api" : "https://my-instance-012345678901-api.us-central1.sourcemanager.dev/v1/projects/my-project/locations/us-central1/repositories/my-repo", "gitHttps" : "https://my-instance-012345678901-git.us-central1.sourcemanager.dev/my-project/my-repo.git", "html" : "https://my-instance-012345678901.us-central1.sourcemanager.dev/my-project/my-repo" } } ] }
查看特定代码库的详细信息
如需列出单个代码库的详细信息,请使用以下 HTTP 方法和网址。
在使用任何请求数据之前,请先进行以下替换:
- PROJECT_ID:运行 Secure Source Manager 的 Google Cloud 项目的项目 ID。
- LOCATION:实例所在的区域。如需了解支持的位置,请参阅位置。
- REPOSITORY_ID:代码库 ID。
HTTP 方法和网址:
GET https://securesourcemanager.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/repositories/REPOSITORY_ID
如需发送您的请求,请展开以下选项之一:
您应该收到类似以下内容的 JSON 响应:
{ "createTime" : "2023-08-09T19:32:15Z", "instance" : "projects/012345678901/locations/us-central1/instances/my-instance", "name" : "projects/my-project/locations/us-central1/repositories/my-repo", "uris" : { "api" : "https://my-instance-012345678901-api.us-central1.sourcemanager.dev/v1/projects/my-project/locations/us-central1/repositories/my-repo", "gitHttps" : "https://my-instance-012345678901-git.us-central1.sourcemanager.dev/my-project/my-repo.git", "html" : "https://my-instance-012345678901.us-central1.sourcemanager.dev/my-project/my-repo" } }
在网页界面中查看代码库
您可以在我的代码库标签页中按关键字搜索代码库。
在 Secure Source Manager 网页界面中,在搜索代码库名称搜索栏中输入搜索关键字。
搜索结果会包含代码库 ID 中包含相应关键字的所有代码库。
选择要查看的代码库。
系统会打开代码库页面。