本頁說明如何在 Dataproc Metastore 資源上附加、卸離及列出標記。如要瞭解 Dataproc Metastore 上的標記,請參閱「使用標記整理 Dataproc Metastore 資源」。
事前準備
如要取得查看及設定 Dataproc Metastore 資源標記所需的權限,請要求管理員授予您專案的下列 IAM 角色:
-
Dataproc Metastore 編輯者 (
roles/metastore.editor): 指派設定及查看標記 -
Dataproc Metastore 檢視者 (
roles/metastore.viewer): 指派檢視標記
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
使用標記
使用 Resource Manager 建立及定義標記後,即可開始搭配 Dataproc Metastore 服務和聯盟資源使用標記。如要進一步瞭解如何使用 Google Cloud CLI 指令建立標記繫結,請參閱 gcloud resource-manager tags bindings。
請在這一頁的所有指令中,替換下列項目:
PARENT_PATH:服務或聯盟資源的完整路徑,例如//metastore.googleapis.com/projects/my-project/locations/us-central1/services/my-service。TAG_VALUE:要附加至資源的標記值,例如設為815471563813/environment/development的標記值包含下列元件:815471563813是機構 ID 或專案 ID。environment是標記鍵。development是標記值。
LOCATION:服務或聯盟所在的區域,例如us-central1。
將標記附加至 Dataproc Metastore 資源
gcloud resource-manager tags bindings create \ --parent=PARENT_PATH \ --tag-value=TAG_VALUE \ --location=LOCATION
從 Dataproc Metastore 資源卸離標記
gcloud resource-manager tags bindings delete \ --parent=PARENT_PATH \ --tag-value=TAG_VALUE \ --location=LOCATION
列出 Dataproc Metastore 資源的標記
gcloud resource-manager tags bindings list \ --parent=PARENT_PATH \ --location=LOCATION