GCP.ApiHub reference
Source:
src/GCP/ApiHub/Api.ts
An API resource in API Hub. Versions, specs, and operations hang off it.
Location and id are immutable. Display name, description, owner,
documentation, fingerprint, selected version, and attributes update in
place. APIs have no labels field — Alchemy stamps ownership into the
description so list / nuke can find them.
Api: Creating an API
Section titled “Api: Creating an API”Generated id
const api = yield* GCP.ApiHub.Api("Pets", { displayName: "pets", description: "Pet store API",});Named API with an owner
const api = yield* GCP.ApiHub.Api("Pets", { apiId: "pets", displayName: "pets", owner: { email: "apihub@example.com", displayName: "platform" },});ApiHubInstance
Section titled “ApiHubInstance”Source:
src/GCP/ApiHub/ApiHubInstance.ts
A Google Cloud API Hub instance. One instance is allowed per project.
Location, instance id, CMEK, and encryption type are immutable. Search, Vertex location, and Agent Registry sync update in place.
ApiHubInstance: Creating an ApiHub Instance
Section titled “ApiHubInstance: Creating an ApiHub Instance”Generated id in us-central1
const hub = yield* GCP.ApiHub.ApiHubInstance("Hub", { labels: { env: "test" }, config: { disableSearch: false },});Named instance with Vertex location
const hub = yield* GCP.ApiHub.ApiHubInstance("Hub", { apiHubInstanceId: "alchemy-hub", location: "us-central1", config: { vertexLocation: "us-central1" },});ApisVersion
Section titled “ApisVersion”Source:
src/GCP/ApiHub/ApisVersion.ts
An API version in API Hub. Specs and operations hang off a version.
Parent API, location, and id are immutable. Display name, description, documentation, deployments, and attributes update in place. Versions have no labels field — Alchemy stamps ownership into the description.
ApisVersion: Creating a Version
Section titled “ApisVersion: Creating a Version”const api = yield* GCP.ApiHub.Api("Pets", { displayName: "pets" });const version = yield* GCP.ApiHub.ApisVersion("V1", { api: api.name, displayName: "v1",});ApisVersionsOperation
Section titled “ApisVersionsOperation”Source:
src/GCP/ApiHub/ApisVersionsOperation.ts
An API operation in an API Hub version. Operations can be created only when the version has no spec-parsed operations.
Parent version and id are immutable. Description, documentation, HTTP
path/method, deprecation, and attributes update in place. Operations
have no labels field — Alchemy stamps ownership into
details.description.
ApisVersionsOperation: Creating an Operation
Section titled “ApisVersionsOperation: Creating an Operation”const version = yield* GCP.ApiHub.ApisVersion("V1", { api: api.name });const operation = yield* GCP.ApiHub.ApisVersionsOperation("ListPets", { version: version.name, details: { httpOperation: { method: "GET", path: { path: "/pets" } }, description: "list pets", },});ApisVersionsSpec
Section titled “ApisVersionsSpec”Source:
src/GCP/ApiHub/ApisVersionsSpec.ts
A spec attached to an API Hub version. Adding an OpenAPI spec parses operations onto the version.
Parent version and id are immutable. Display name, source URI, contents, spec type, and attributes update in place. Specs have no labels field — Alchemy stamps ownership into the display name.
ApisVersionsSpec: Creating a Spec
Section titled “ApisVersionsSpec: Creating a Spec”const spec = yield* GCP.ApiHub.ApisVersionsSpec("OpenApi", { version: version.name, displayName: "openapi.yaml", contents: { contents: "openapi: 3.0.0\ninfo:\n title: pets\n version: 1.0.0\npaths: {}\n", mimeType: "application/yaml", },});Attribute
Section titled “Attribute”Source:
src/GCP/ApiHub/Attribute.ts
A user-defined attribute in API Hub. System-defined attributes cannot be created or deleted through this resource.
Location, id, data type, and scope are immutable. Display name, description, allowed values, and cardinality (increase only) update in place. Attributes have no labels field — Alchemy stamps ownership into the description.
Attribute: Creating an Attribute
Section titled “Attribute: Creating an Attribute”String attribute on APIs
const attribute = yield* GCP.ApiHub.Attribute("OwnerTeam", { displayName: "owner-team", dataType: "STRING", scope: "API",});Enum attribute
const attribute = yield* GCP.ApiHub.Attribute("Tier", { displayName: "tier", dataType: "ENUM", scope: "API", allowedValues: [ { id: "gold", displayName: "gold" }, { id: "silver", displayName: "silver" }, ],});Curation
Section titled “Curation”Source:
src/GCP/ApiHub/Curation.ts
A curation resource in API Hub. Plugin instances invoke the endpoint with API metadata and receive curated metadata back.
Location, id, and endpoint are immutable. Display name and description update in place. Curations have no labels field — Alchemy stamps ownership into the description.
Curation: Creating a Curation
Section titled “Curation: Creating a Curation”const curation = yield* GCP.ApiHub.Curation("Curate", { displayName: "curate-apis", endpoint: { applicationIntegrationEndpointDetails: { uri: "https://integrations.googleapis.com/v1/projects/my-project/locations/us-central1/integrations/curate:execute", triggerId: "api_trigger/curate", }, },});Dependency
Section titled “Dependency”Source:
src/GCP/ApiHub/Dependency.ts
A directed dependency in API Hub from a consumer operation (or external API) to a supplier operation (or external API).
Location, id, consumer, and supplier are immutable. Description updates in place. Dependencies have no labels field — Alchemy stamps ownership into the description.
Dependency: Creating a Dependency
Section titled “Dependency: Creating a Dependency”const dependency = yield* GCP.ApiHub.Dependency("Calls", { consumer: { operationResourceName: listPets.name }, supplier: { operationResourceName: getPet.name }, description: "listPets calls getPet",});Deployment
Section titled “Deployment”Source:
src/GCP/ApiHub/Deployment.ts
An API Hub deployment — a gateway, proxy, or other runtime that hosts APIs. Deployments are root-level entities and exist independently of any API.
API Hub deployments have no labels, so Alchemy stamps ownership into
the description for list / nuke. Location and deployment id are
identity — changing them replaces the deployment. Display name,
description, type, URI, endpoints, and related attributes update in
place.
Deployment: Creating a Deployment
Section titled “Deployment: Creating a Deployment”Generated id
const deployment = yield* GCP.ApiHub.Deployment("Orders", { resourceUri: "organizations/cymbal/environments/staging/apis/orders", endpoints: ["https://orders.example.com"],});Named deployment with type and description
const deployment = yield* GCP.ApiHub.Deployment("Orders", { deploymentId: "orders-staging", displayName: "orders staging", description: "checkout proxy", resourceUri: "organizations/cymbal/environments/staging/apis/orders", endpoints: ["https://orders.example.com"], deploymentType: { enumValues: { values: [{ id: "apigee" }] } },});Deployment: Updating a Deployment
Section titled “Deployment: Updating a Deployment”const deployment = yield* GCP.ApiHub.Deployment("Orders", { resourceUri: "organizations/cymbal/environments/staging/apis/orders", endpoints: ["https://orders.example.com", "https://orders-alt.example.com"], description: "checkout proxy (updated)",});ExternalApi
Section titled “ExternalApi”Source:
src/GCP/ApiHub/ExternalApi.ts
An API Hub External API — a third-party API modeled so it can be referenced from dependencies.
External APIs have no labels, so Alchemy stamps ownership into the
description for list / nuke. Location and id are identity — changing
them replaces the resource. Display name, description, documentation,
endpoints, and paths update in place.
ExternalApi: Creating an External API
Section titled “ExternalApi: Creating an External API”Generated id
const stripe = yield* GCP.ApiHub.ExternalApi("Stripe", { displayName: "Stripe", endpoints: ["https://api.stripe.com"], paths: ["/v1/charges"],});Named External API
const stripe = yield* GCP.ApiHub.ExternalApi("Stripe", { externalApiId: "stripe-prod", displayName: "Stripe", description: "payments", endpoints: ["https://api.stripe.com"],});ExternalApi: Updating an External API
Section titled “ExternalApi: Updating an External API”const stripe = yield* GCP.ApiHub.ExternalApi("Stripe", { displayName: "Stripe", description: "payments (updated)", paths: ["/v1/charges", "/v1/customers"],});Plugin
Section titled “Plugin”Source:
src/GCP/ApiHub/Plugin.ts
An API Hub plugin — a user-owned or system-owned connector that publishes API metadata into Hub.
Plugins have no labels and no patch RPC, so Alchemy stamps ownership into the description and treats body-field changes as replacements. Enable/disable syncs in place. Location and plugin id are identity.
Plugin: Creating a Plugin
Section titled “Plugin: Creating a Plugin”Generated id with the default action
const plugin = yield* GCP.ApiHub.Plugin("OnRamp", { displayName: "on-ramp", description: "custom collector",});Named plugin with an explicit action
const plugin = yield* GCP.ApiHub.Plugin("OnRamp", { pluginId: "orders-onramp", displayName: "orders on-ramp", pluginCategory: "API_PRODUCER", actionsConfig: [ { id: "sync-metadata", displayName: "Sync metadata", description: "pull specs", triggerMode: "API_HUB_ON_DEMAND_TRIGGER", }, ],});PluginsInstance
Section titled “PluginsInstance”Source:
src/GCP/ApiHub/PluginsInstance.ts
An API Hub plugin instance — a configured running copy of a plugin.
Plugin instances have no labels or description, so Alchemy stamps
ownership into the display name for list / nuke. Plugin, location,
and instance id are identity. Display name (and schedule cron on
actions) update in place; auth/additional config changes replace the
instance because ApplyPluginInstanceConfig is not in the distilled SDK.
PluginsInstance: Creating a Plugin Instance
Section titled “PluginsInstance: Creating a Plugin Instance”Instance of a user-owned plugin
const plugin = yield* GCP.ApiHub.Plugin("OnRamp", { displayName: "on-ramp",});const instance = yield* GCP.ApiHub.PluginsInstance("Collector", { plugin: plugin.name, displayName: "orders collector",});Named instance with an explicit action
const instance = yield* GCP.ApiHub.PluginsInstance("Collector", { plugin: plugin.name, pluginInstanceId: "orders-collector", actions: [{ actionId: "sync-metadata" }],});RuntimeProjectAttachment
Section titled “RuntimeProjectAttachment”Source:
src/GCP/ApiHub/RuntimeProjectAttachment.ts
An API Hub runtime project attachment. Attaching a runtime project lets API Hub discover deployments in that project.
Attachments have no labels, description, or display name, and the id
is forced to the runtime project id, so list cannot stamp ownership.
The resource is existence-only: runtime project and location are
identity, and there is nothing mutable to sync.
RuntimeProjectAttachment: Creating a Runtime Project Attachment
Section titled “RuntimeProjectAttachment: Creating a Runtime Project Attachment”Attach the stack project
const attachment = yield* GCP.ApiHub.RuntimeProjectAttachment( "Runtime", {},);Attach a specific runtime project
const attachment = yield* GCP.ApiHub.RuntimeProjectAttachment( "Runtime", { runtimeProject: "projects/my-runtime", location: "us-central1", },);