Google IDX icon

Google IDX

Google IDX

Get Status Workstation

AI-generated

Overview

This node integrates with Google Cloud Workstations via the Google Workstations API and related services. It allows users to manage and monitor workstations within their Google Cloud projects, including retrieving workstation status, starting or stopping workstations, generating access tokens, running commands remotely, and initializing or resetting workstation data.

Common scenarios where this node is beneficial include:

  • Automating the monitoring of workstation states across multiple projects.
  • Managing lifecycle operations such as starting, stopping, or resetting workstations programmatically.
  • Running remote commands on workstations using gcloud CLI inside Docker containers.
  • Initializing workstation environment data for further automation workflows.
  • Fetching detailed status reports about workstations grouped by their runtime state.

Practical example:

  • A DevOps engineer can use this node to periodically check which workstations are running or stopped and trigger alerts or automated start/stop actions based on usage patterns.
  • Developers can run custom commands on remote workstations directly from n8n without manual SSH access, streamlining CI/CD pipelines.

Properties

Name Meaning
Project ID Select or enter your Google Cloud project ID. Can be chosen from a list of accessible projects or entered manually as a string.
Is Global Data Boolean flag indicating whether to use global workflow static data instead of node-specific data.
Global Data JSON object containing global data to be used if "Is Global Data" is set to true.

Output

The node outputs an array of JSON objects, each representing the result of the requested operation. The structure varies depending on the operation:

  • getStatusWorkstation: Outputs a JSON object with keys STATE_STARTING, STATE_RUNNING, and STATE_STOPPED, each containing arrays of workstation identifiers grouped by their current state.

  • liveWorkstation: Outputs status codes and names of live workstations, indicating if they are running, stopped, or if the access token has expired.

  • startWorkstation, stopWorkstation, generateAccessToken, getWorkstation: Outputs the raw JSON response from the Google Workstations API corresponding to the action performed.

  • resetWorkstation: Outputs a simple JSON confirmation { status: "reset-complete" }.

  • updateWorkstation: Outputs parsed JSON data extracted from URLs related to workstation configuration, including project ID, location, cluster, and workspace.

  • workstationInitialization: Outputs JSON objects containing node information and workstation environment data fetched from Google APIs.

  • manualWorkstation: Outputs JSON objects describing manual commands/actions to be executed on specified workstations.

  • runCommandWorkstation: Outputs JSON containing command execution results including timestamps, access tokens, project details, exit codes, stdout, and stderr.

If binary data were involved (not indicated in this code), it would typically represent files or command output streams, but this node primarily deals with JSON data.

Dependencies

  • Requires an OAuth2 API credential for authenticating with Google services.
  • Uses Google Workstations API endpoints (workstations.googleapis.com).
  • Requires the gcloud CLI installed and accessible when running commands via Docker.
  • Depends on Docker being available if executing commands inside containers.
  • Node uses internal helper methods for OAuth2 requests and workflow static data management.
  • Environment variables or credentials must provide valid Google Cloud project access and permissions.

Troubleshooting

  • Missing or invalid Project ID: Operations that require a project ID will fail if not provided or incorrect. Ensure the project ID is selected or entered correctly.
  • Invalid input format for manual commands: The manual workstation operation expects commands in a specific format (e.g., /run -a USER -ws SLUG[,SLUG2] -c COMMAND). Errors occur if this format is not followed.
  • Access token expiration: Live workstation status checks may return an "accessToken-exp" status if the OAuth token has expired. Refresh credentials or reauthenticate.
  • Docker or gcloud CLI issues: Running commands requires Docker and gcloud CLI setup. Errors during command execution may indicate missing installations or misconfigurations.
  • API request failures: Network issues, insufficient permissions, or invalid credentials can cause API calls to fail. Check credentials and network connectivity.
  • Unsupported operations: Attempting to use an operation not implemented by the node will throw an error specifying the unsupported operation.

Links and References

Discussion