本頁面說明如何為 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