Skip to content

GCP.Workstations reference

Source: src/GCP/Workstations/GenerateAccessToken.ts

Runtime binding for Cloud Workstations workstations.generateAccessToken.

Bind this operation to a WorkstationClustersWorkstationConfigsWorkstation in a Function/Action init phase. Provide GenerateAccessTokenHttp. Grants roles/workstations.user on the workstation only.

GenerateAccessToken: Authenticating to a Workstation

Section titled “GenerateAccessToken: Authenticating to a Workstation”
const generate = yield* GCP.Workstations.GenerateAccessToken(dev);
const { accessToken, expireTime } = yield* generate({
body: { ttl: "3600s" },
});

Source: src/GCP/Workstations/GenerateAccessTokenHttp.ts Kind: Layer · Provides: GCP.Workstations.GenerateAccessToken

HTTP implementation of GenerateAccessToken.

Source: src/GCP/Workstations/GetWorkstation.ts

Runtime binding for Cloud Workstations workstations.get.

Bind this operation to a WorkstationClustersWorkstationConfigsWorkstation in a Function/Action init phase. Provide GetWorkstationHttp. Grants roles/workstations.viewer on the workstation only.

const getWorkstation = yield* GCP.Workstations.GetWorkstation(dev);
const live = yield* getWorkstation();

Source: src/GCP/Workstations/GetWorkstationCluster.ts

Runtime binding for Cloud Workstations workstationClusters.get.

Bind this operation to a WorkstationCluster in a Function/Action init phase. Provide GetWorkstationClusterHttp.

Grants roles/workstations.viewer on the project because workstation clusters have no IAM policy of their own.

const getCluster = yield* GCP.Workstations.GetWorkstationCluster(cluster);
const live = yield* getCluster();

Source: src/GCP/Workstations/GetWorkstationClusterHttp.ts Kind: Layer · Provides: GCP.Workstations.GetWorkstationCluster

HTTP implementation of GetWorkstationCluster.

Source: src/GCP/Workstations/GetWorkstationConfig.ts

Runtime binding for Cloud Workstations workstationConfigs.get.

Bind this operation to a WorkstationClustersWorkstationConfig in a Function/Action init phase. Provide GetWorkstationConfigHttp. Grants roles/workstations.viewer on the configuration only.

GetWorkstationConfig: Observing Configurations

Section titled “GetWorkstationConfig: Observing Configurations”
const getConfig = yield* GCP.Workstations.GetWorkstationConfig(config);
const live = yield* getConfig();

Source: src/GCP/Workstations/GetWorkstationConfigHttp.ts Kind: Layer · Provides: GCP.Workstations.GetWorkstationConfig

HTTP implementation of GetWorkstationConfig.

Source: src/GCP/Workstations/GetWorkstationHttp.ts Kind: Layer · Provides: GCP.Workstations.GetWorkstation

HTTP implementation of GetWorkstation.

Source: src/GCP/Workstations/StartWorkstation.ts

Runtime binding for Cloud Workstations workstations.start.

Bind this operation to a WorkstationClustersWorkstationConfigsWorkstation in a Function/Action init phase. Provide StartWorkstationHttp. Grants roles/workstations.user on the workstation only.

const start = yield* GCP.Workstations.StartWorkstation(dev);
yield* start();

Source: src/GCP/Workstations/StartWorkstationHttp.ts Kind: Layer · Provides: GCP.Workstations.StartWorkstation

HTTP implementation of StartWorkstation.

Source: src/GCP/Workstations/StopWorkstation.ts

Runtime binding for Cloud Workstations workstations.stop.

Bind this operation to a WorkstationClustersWorkstationConfigsWorkstation in a Function/Action init phase. Provide StopWorkstationHttp. Grants roles/workstations.user on the workstation only.

const stop = yield* GCP.Workstations.StopWorkstation(dev);
yield* stop();

Source: src/GCP/Workstations/StopWorkstationHttp.ts Kind: Layer · Provides: GCP.Workstations.StopWorkstation

HTTP implementation of StopWorkstation.

Source: src/GCP/Workstations/WorkstationCluster.ts

A Cloud Workstations cluster — a regional group of workstations attached to a VPC network.

Changing workstationClusterId, location, network, subnetwork, domainConfig, tags, or privateClusterConfig.enablePrivateEndpoint replaces the cluster. Display name, labels, annotations, launch URLs, gateway config, and allowedProjects update in place.

Generated name on the default VPC

const cluster = yield* GCP.Workstations.WorkstationCluster("Dev", {});

Explicit id, network, and labels

const cluster = yield* GCP.Workstations.WorkstationCluster("Dev", {
workstationClusterId: "app-dev",
location: "us-central1",
network: "default",
subnetwork: "default",
displayName: "app-dev workstations",
labels: { env: "prod" },
});
// Same logical id, changed props: the engine updates it in place.
const cluster = yield* GCP.Workstations.WorkstationCluster("Dev", {
displayName: "app-dev workstations v2",
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/Workstations/WorkstationClustersWorkstationConfig.ts

A Cloud Workstations configuration — the template for workstation VMs (machine type, image, disks, timeouts).

Changing workstationConfigId, location, workstationCluster, replicaZones, or encryptionKey replaces the configuration. Display name, labels, container, host, timeouts, directories, and ports update in place.

WorkstationClustersWorkstationConfig: Creating a Configuration

Section titled “WorkstationClustersWorkstationConfig: Creating a Configuration”

Generated name

const config = yield* GCP.Workstations.WorkstationClustersWorkstationConfig(
"Code",
{ workstationCluster: cluster.name },
);

Custom machine type and image

const config = yield* GCP.Workstations.WorkstationClustersWorkstationConfig(
"Code",
{
workstationCluster: cluster.name,
idleTimeout: "1800s",
host: { gceInstance: { machineType: "e2-standard-4", poolSize: 0 } },
labels: { env: "prod" },
},
);

WorkstationClustersWorkstationConfig: Updating a Configuration

Section titled “WorkstationClustersWorkstationConfig: Updating a Configuration”
// Same logical id, changed props: the engine updates it in place.
const config = yield* GCP.Workstations.WorkstationClustersWorkstationConfig(
"Code",
{
workstationCluster: cluster.name,
displayName: "code v2",
idleTimeout: "3600s",
},
);

WorkstationClustersWorkstationConfigsWorkstation

Section titled “WorkstationClustersWorkstationConfigsWorkstation”

Source: src/GCP/Workstations/WorkstationClustersWorkstationConfigsWorkstation.ts

A Cloud Workstations workstation — a single developer VM with its own persistent storage, created from a workstation configuration.

Changing workstationId, location, workstationConfig, workstationCluster, or sourceWorkstation replaces the workstation. Display name, labels, annotations, env, and persistent directory size update in place.

WorkstationClustersWorkstationConfigsWorkstation: Creating a Workstation

Section titled “WorkstationClustersWorkstationConfigsWorkstation: Creating a Workstation”

Generated name

const workstation =
yield* GCP.Workstations.WorkstationClustersWorkstationConfigsWorkstation(
"Mine",
{ workstationConfig: config.name },
);

Explicit id and labels

const workstation =
yield* GCP.Workstations.WorkstationClustersWorkstationConfigsWorkstation(
"Mine",
{
workstationConfig: config.name,
displayName: "alice-dev",
labels: { env: "prod" },
},
);

WorkstationClustersWorkstationConfigsWorkstation: Updating a Workstation

Section titled “WorkstationClustersWorkstationConfigsWorkstation: Updating a Workstation”
// Same logical id, changed props: the engine updates it in place.
const workstation =
yield* GCP.Workstations.WorkstationClustersWorkstationConfigsWorkstation(
"Mine",
{
workstationConfig: config.name,
displayName: "alice-dev v2",
env: { EDITOR: "vim" },
},
);