查看及切換情境

機構和專案是 Google Distributed Cloud (GDC) 實體隔離設備資源階層中可用的兩個環境。您可以使用 gdcloud CLI 屬性,在機構和專案之間切換。

查看現有設定

初始化 gdcloud CLI 後,請使用下列指令查看機構和專案的現有設定。

列出目前有效設定的 gcloud CLI 屬性:

gdcloud config list

列印機構控制台網址:

gdcloud config get organization_console_url

列印專案屬性:

gdcloud config get project

切換情境

如要切換至新的機構或專案環境,可以在有效設定或另一個具名設定中設定屬性。

設定使用中設定中的屬性

切換至新機構:

gdcloud config set organization_console_url ORGANIZATION_CONSOLE_URL

切換至新專案:

gdcloud config set project PROJECT_ID

在新命名設定中設定屬性

假設您已建立新的具名設定 example,並設定了特定 https://console.example-org.comexample-project

gdcloud config configurations create example

gdcloud config set organization_console_url https://console.example-org.com
gdcloud config set project example-project

接著,您就能啟用設定,切換使用這類背景資訊: example

gdcloud config configurations activate example