本文說明如何啟用產品和功能的 API,保護軟體供應鏈。
如要收集及查看軟體供應鏈洞察資料,請啟用下列 API:
- Artifact Analysis API,用於儲存其他Google Cloud 服務產生及使用的中繼資料。
- Container Scanning API,掃描儲存在 Artifact Registry 中的容器映像檔,檢查是否有安全漏洞和其他中繼資料。啟用這個 API 時,系統會自動啟用 Artifact Analysis API。
- Artifact Registry 儲存建構作業構件。
- Cloud Build 可產生建構出處中繼資料。
- (僅限 GKE) Container Security API,可掃描執行中的工作負載,找出作業系統安全漏洞。
您必須在與 Artifact Registry 相同的 Google Cloud專案中執行 Container Scanning API。您可以在不同的專案中執行使用登錄的其他 Google Cloud 服務。
啟用深入分析功能所需的 API
如要啟用產生及查看洞察資料所需的 API,請按照下列步驟操作:
主控台
在同一個專案中使用所有服務
一併啟用必要的 API。
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM
role (roles/serviceusage.serviceUsageAdmin), which
contains the serviceusage.services.enable permission. Learn how to grant
roles.
使用不同專案
在要執行 Artifact Registry 的專案中,啟用 Container Scanning 和 Artifact Registry。
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.在執行 Cloud Build 的專案中啟用 Cloud Build API。
在執行 GKE 的專案中啟用 Container Security API。
Google Cloud CLI
在同一個專案中使用所有服務
一併啟用必要的 API。
gcloud services enable containerscanning.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com \
containersecurity.googleapis.com
使用不同專案
在要執行 Artifact Registry 的專案中,啟用 Container Scanning 和 Artifact Registry。將
AR_PROJECT替換為適當的 Google Cloud 專案 ID。gcloud services enable containerscanning.googleapis.com \ artifactregistry.googleapis.com \ --project=AR_PROJECT在執行 Cloud Build 的專案中啟用 Cloud Build API。將
BUILD_PROJECT替換為適當的 Google Cloud 專案 ID。gcloud services enable cloudbuild.googleapis.com \ --project=BUILD_PROJECT在執行 GKE 的專案中啟用 Container Security API。將
GKE_PROJECT替換為適當的 Google Cloud 專案 ID。gcloud services enable containersecurity.googleapis.com \ --project=GKE_PROJECT
您已啟用產生及查看深入分析所需的最低 API 數量,這些深入分析會顯示在Google Cloud 控制台面板和 GKE 安全性狀態資訊主頁中。
您可以從 API 程式庫啟用其他服務的 API,也可以使用 gcloud services enable 指令啟用。