GCP.ServiceDirectory reference
Endpoint
Section titled “Endpoint”Source:
src/GCP/ServiceDirectory/Endpoint.ts
A Service Directory endpoint — an address/port registration on a service. The parent service must already exist.
Changing endpointId, service, namespace, location, or
network replaces the endpoint. address, port, and annotations
update in place.
Endpoints have no labels field. Alchemy stamps ownership into
annotations so list / pnpm nuke:gcp can find owned endpoints
under alchemy-labeled namespaces.
Endpoint: Creating an Endpoint
Section titled “Endpoint: Creating an Endpoint”Address and port on a service
const ns = yield* GCP.ServiceDirectory.Namespace("Services", {});const api = yield* GCP.ServiceDirectory.Service("Api", { namespace: ns.name,});const endpoint = yield* GCP.ServiceDirectory.Endpoint("Https", { service: api.name, address: "10.0.0.1", port: 443,});Explicit id and annotations
const endpoint = yield* GCP.ServiceDirectory.Endpoint("Https", { service: api.name, endpointId: "api-https", address: "10.0.0.1", port: 443, annotations: { protocol: "https" },});GetEndpoint
Section titled “GetEndpoint”Source:
src/GCP/ServiceDirectory/GetEndpoint.ts
Runtime binding for Service Directory endpoints.get.
Bind this operation to an Endpoint in a Function/Action init
phase. Provide GetEndpointHttp.
GetEndpoint: Reading an Endpoint
Section titled “GetEndpoint: Reading an Endpoint”const getEndpoint = yield* GCP.ServiceDirectory.GetEndpoint(api);const live = yield* getEndpoint();GetEndpointHttp
Section titled “GetEndpointHttp”Source:
src/GCP/ServiceDirectory/GetEndpointHttp.tsKind: Layer · Provides:GCP.ServiceDirectory.GetEndpoint
HTTP implementation of GetEndpoint.
Namespace
Section titled “Namespace”Source:
src/GCP/ServiceDirectory/Namespace.ts
A Service Directory namespace — a location-scoped container for services.
Changing namespaceId or location replaces the namespace.
Namespace: Creating a Namespace
Section titled “Namespace: Creating a Namespace”Generated name
const services = yield* GCP.ServiceDirectory.Namespace("Services", {});Explicit id, location, and labels
const services = yield* GCP.ServiceDirectory.Namespace("Services", { namespaceId: "app-services", location: "us-central1", labels: { env: "prod" },});Resolve
Section titled “Resolve”Source:
src/GCP/ServiceDirectory/Resolve.ts
Runtime binding for Service Directory services.resolve.
Looks up a Service and its endpoints. Bind this operation in a
Function/Action init phase. Provide ResolveHttp.
Resolve: Resolving a Service
Section titled “Resolve: Resolving a Service”Resolve endpoints
const resolve = yield* GCP.ServiceDirectory.Resolve(api);const { service } = yield* resolve();Filter endpoints
const { service } = yield* resolve({ body: { endpointFilter: "port>8080", maxEndpoints: 10 },});ResolveHttp
Section titled “ResolveHttp”Source:
src/GCP/ServiceDirectory/ResolveHttp.tsKind: Layer · Provides:GCP.ServiceDirectory.Resolve
HTTP implementation of Resolve.
Service
Section titled “Service”Source:
src/GCP/ServiceDirectory/Service.ts
A Service Directory service — a named registration that holds endpoints and client-facing annotations.
Changing serviceId, namespace, or location replaces the service.
Annotations update in place. Services have no labels field; Alchemy
stamps ownership into annotations so list / pnpm nuke:gcp can find
them.
Service: Creating a Service
Section titled “Service: Creating a Service”Generated name in a namespace
const ns = yield* GCP.ServiceDirectory.Namespace("Services", {});const api = yield* GCP.ServiceDirectory.Service("Api", { namespace: ns.name,});Explicit id and annotations
const api = yield* GCP.ServiceDirectory.Service("Api", { namespace: ns.name, serviceId: "checkout", annotations: { protocol: "http" },});Service: Resolving Endpoints
Section titled “Service: Resolving Endpoints”const resolve = yield* GCP.ServiceDirectory.Resolve(api);const { service } = yield* resolve();