Skip to content

GCP.AppHub reference

Source: src/GCP/AppHub/Application.ts

An App Hub application — the governance boundary for services and workloads that perform a logical end-to-end business function.

Applications have no labels field, so Alchemy stamps ownership into the description for list / nuke. Id, location, and scope are immutable. Display name, description, and attributes update in place.

Regional application

const app = yield* GCP.AppHub.Application("Checkout", {
location: "us-central1",
displayName: "checkout",
scope: { type: "REGIONAL" },
});

Attributes and description

const app = yield* GCP.AppHub.Application("Checkout", {
displayName: "checkout",
description: "payments",
attributes: {
criticality: { type: "HIGH" },
environment: { type: "PRODUCTION" },
},
});

Change props on the same logical id; the engine keeps the physical id.

const app = yield* GCP.AppHub.Application("Checkout", {
displayName: "checkout-v2",
description: "payments v2",
attributes: {
criticality: { type: "MISSION_CRITICAL" },
environment: { type: "PRODUCTION" },
},
});

Source: src/GCP/AppHub/ApplicationsService.ts

An App Hub service registered onto an Application. A service is a discovered network or API interface (forwarding rule, URL map, Cloud Run service, …) that exposes functionality over the network.

Services have no labels field, so Alchemy stamps ownership into the description for list / nuke. Application, service id, and discoveredService are immutable. Display name, description, and attributes update in place.

Register a discovered service

const service = yield* GCP.AppHub.ApplicationsService("Frontend", {
application: app.name,
discoveredService: discovered.name,
});

Lookup from an underlying resource URI

const service = yield* GCP.AppHub.ApplicationsService("Frontend", {
application: app.name,
discoveredService: forwardingRule.selfLink,
displayName: "frontend",
description: "https load balancer",
});

Change props on the same logical id; the engine keeps the physical id.

const service = yield* GCP.AppHub.ApplicationsService("Frontend", {
application: app.name,
discoveredService: discovered.name,
displayName: "frontend-v2",
attributes: { criticality: { type: "HIGH" } },
});

Source: src/GCP/AppHub/ApplicationsWorkload.ts

An App Hub workload registered onto an Application. A workload is a discovered binary deployment (managed instance group, GKE deployment, …) that performs the smallest logical subset of business functionality.

Workloads have no labels field, so Alchemy stamps ownership into the description for list / nuke. Application, workload id, and discoveredWorkload are immutable. Display name, description, and attributes update in place.

Register a discovered workload

const workload = yield* GCP.AppHub.ApplicationsWorkload("Api", {
application: app.name,
discoveredWorkload: discovered.name,
});

Lookup from an underlying resource URI

const workload = yield* GCP.AppHub.ApplicationsWorkload("Api", {
application: app.name,
discoveredWorkload: instanceGroup.instanceGroup,
displayName: "api",
description: "checkout mig",
});

Change props on the same logical id; the engine keeps the physical id.

const workload = yield* GCP.AppHub.ApplicationsWorkload("Api", {
application: app.name,
discoveredWorkload: discovered.name,
displayName: "api-v2",
attributes: { criticality: { type: "HIGH" } },
});

Source: src/GCP/AppHub/ServiceProjectAttachment.ts

An App Hub service project attachment. Service projects hold the underlying cloud resources and expose them to a host project so App Hub can provide an aggregated view.

Attachments have no labels, description, or display name, and the id is forced to the service project id, so list cannot stamp ownership. Location is always global. The resource is existence-only: service project is identity, and there is nothing mutable to sync.

ServiceProjectAttachment: Creating a Service Project Attachment

Section titled “ServiceProjectAttachment: Creating a Service Project Attachment”

Attach the stack project

const attachment = yield* GCP.AppHub.ServiceProjectAttachment(
"Host",
{},
);

Attach a specific service project

const attachment = yield* GCP.AppHub.ServiceProjectAttachment(
"Payments",
{ serviceProject: "projects/my-service" },
);