我想在 golang 中列出 GCP 工件注冊表中的所有存儲庫。當(dāng)前代碼:(https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1beta2) c, err := artifactregistry.NewClient(ctx, option.WithCredentialsFile("<service account json>")) if err != nil { // no error here } defer c.Close() req := &artifactregistrypb.ListRepositoriesRequest{ Parent: "<project-id>", } it := c.ListRepositories(ctx, req) for { resp, err := it.Next() if err == nil { fmt.Println("resp", resp) } else { fmt.Println("err ==>", err) } }錯誤打?。篒nvalid field value in the request.或者有時我得到Request contains an invalid argument我在這里做錯了什么?“父母”是什么意思?(在 ListRepositoriesRequest 中)在進一步挖掘中,我發(fā)現(xiàn)在 Parent 中傳遞的值轉(zhuǎn)到:“x-goog-request-params”,正確的格式應(yīng)該是什么?
1 回答

青春有我
TA貢獻1784條經(jīng)驗 獲得超8個贊
有時圖書館/ api有據(jù)可查,有時沒有......
這里是您可以在 API 資源管理器中測試的 REST API(右側(cè)欄)。經(jīng)過一些測試,父級必須具有該格式
projects/<PROJECT_ID>/locations/<REGION>
嘗試解決您的問題
- 1 回答
- 0 關(guān)注
- 104 瀏覽
添加回答
舉報
0/150
提交
取消