Skip to content

GCP.ServiceDirectory reference

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.

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" },
});

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.

const getEndpoint = yield* GCP.ServiceDirectory.GetEndpoint(api);
const live = yield* getEndpoint();

Source: src/GCP/ServiceDirectory/GetEndpointHttp.ts Kind: Layer · Provides: GCP.ServiceDirectory.GetEndpoint

HTTP implementation of GetEndpoint.

Source: src/GCP/ServiceDirectory/Namespace.ts

A Service Directory namespace — a location-scoped container for services.

Changing namespaceId or location replaces the 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" },
});

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 endpoints

const resolve = yield* GCP.ServiceDirectory.Resolve(api);
const { service } = yield* resolve();

Filter endpoints

const { service } = yield* resolve({
body: { endpointFilter: "port>8080", maxEndpoints: 10 },
});

Source: src/GCP/ServiceDirectory/ResolveHttp.ts Kind: Layer · Provides: GCP.ServiceDirectory.Resolve

HTTP implementation of Resolve.

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.

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" },
});
const resolve = yield* GCP.ServiceDirectory.Resolve(api);
const { service } = yield* resolve();