View and switch context

Organization and project are the two available contexts within the Google Distributed Cloud Hosted (GDCH) resource hierarchy. You can switch between organizations and projects using gdcloud CLI properties. You can view the current settings for your organization and project.

View the existing settings

After you initialize the gdcloud CLI, view the existing settings for your organization and project using the following commands.

List gdcloud CLI properties for the currently active configuration:

gdcloud config list

Print the organization console URL:

gdcloud config get organization_console_url

Print the project property:

gdcloud config get project

Switch between contexts

If you want to switch to a new organization or project context, you can set the properties either in your active configuration, or in another named configuration.

Set properties in the active configuration

Switch to a new organization:

gdcloud config set organization_console_url ORGANIZATION_CONSOLE_URL

Switch to a new project:

gdcloud config set project PROJECT_ID

Set properties in a new named configuration

Assume you have created a new named configuration example which has been set with specific and example-project:

gdcloud config configurations create example

gdcloud config set organization_console_url
gdcloud config set project example-project

Then you can switch to use such contexts by activating the configuration example:

gdcloud config configurations activate example