GCP.ApiHub reference
Source:
packages/gcp/src/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" },});Api: Looking up an existing api
Section titled “Api: Looking up an existing api”Api.lookup references an api Alchemy doesn’t manage (created in the
console or by another stack). It is read during plan/deploy, never
created, updated or deleted, and binds like a declared api.
const api = GCP.ApiHub.Api.lookup({ apiId: "my-api" });ApiHubInstance
Section titled “ApiHubInstance”Source:
packages/gcp/src/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" },});ApiHubInstance: Looking up an existing api hub instance
Section titled “ApiHubInstance: Looking up an existing api hub instance”ApiHubInstance.lookup references an api hub instance Alchemy doesn’t
manage (created in the console or by another stack). It is read during
plan/deploy, never created, updated or deleted, and binds like a declared
api hub instance.
const apiHubInstance = GCP.ApiHub.ApiHubInstance.lookup({ apiHubInstanceId: "my-api-hub-instance",});ApisVersion
Section titled “ApisVersion”Source:
packages/gcp/src/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",});ApisVersion: Looking up an existing apis version
Section titled “ApisVersion: Looking up an existing apis version”ApisVersion.lookup references an apis version Alchemy doesn’t manage
(created in the console or by another stack). It is read during
plan/deploy, never created, updated or deleted, and binds like a declared
apis version.
const apisVersion = GCP.ApiHub.ApisVersion.lookup({ versionId: "my-version", api: "my-api",});ApisVersionsOperation
Section titled “ApisVersionsOperation”Source:
packages/gcp/src/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", },});ApisVersionsOperation: Looking up an existing apis versions operation
Section titled “ApisVersionsOperation: Looking up an existing apis versions operation”ApisVersionsOperation.lookup references an apis versions operation
Alchemy doesn’t manage (created in the console or by another stack). It
is read during plan/deploy, never created, updated or deleted, and binds
like a declared apis versions operation.
const apisVersionsOperation = GCP.ApiHub.ApisVersionsOperation.lookup({ apiOperationId: "my-api-operation", version: "my-version",});ApisVersionsSpec
Section titled “ApisVersionsSpec”Source:
packages/gcp/src/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", },});ApisVersionsSpec: Looking up an existing apis versions spec
Section titled “ApisVersionsSpec: Looking up an existing apis versions spec”ApisVersionsSpec.lookup references an apis versions spec Alchemy
doesn’t manage (created in the console or by another stack). It is read
during plan/deploy, never created, updated or deleted, and binds like a
declared apis versions spec.
const apisVersionsSpec = GCP.ApiHub.ApisVersionsSpec.lookup({ specId: "my-spec", version: "my-version",});Attribute
Section titled “Attribute”Source:
packages/gcp/src/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" }, ],});Attribute: Looking up an existing attribute
Section titled “Attribute: Looking up an existing attribute”Attribute.lookup references an attribute Alchemy doesn’t manage
(created in the console or by another stack). It is read during
plan/deploy, never created, updated or deleted, and binds like a declared
attribute.
const attribute = GCP.ApiHub.Attribute.lookup({ attributeId: "my-attribute",});Curation
Section titled “Curation”Source:
packages/gcp/src/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", }, },});Curation: Looking up an existing curation
Section titled “Curation: Looking up an existing curation”Curation.lookup references a curation Alchemy doesn’t manage (created
in the console or by another stack). It is read during plan/deploy, never
created, updated or deleted, and binds like a declared curation.
const curation = GCP.ApiHub.Curation.lookup({ curationId: "my-curation" });Dependency
Section titled “Dependency”Source:
packages/gcp/src/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",});Dependency: Looking up an existing dependency
Section titled “Dependency: Looking up an existing dependency”Dependency.lookup references a dependency Alchemy doesn’t manage
(created in the console or by another stack). It is read during
plan/deploy, never created, updated or deleted, and binds like a declared
dependency.
const dependency = GCP.ApiHub.Dependency.lookup({ dependencyId: "my-dependency",});Deployment
Section titled “Deployment”Source:
packages/gcp/src/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)",});Deployment: Looking up an existing deployment
Section titled “Deployment: Looking up an existing deployment”Deployment.lookup references a deployment Alchemy doesn’t manage
(created in the console or by another stack). It is read during
plan/deploy, never created, updated or deleted, and binds like a declared
deployment.
const deployment = GCP.ApiHub.Deployment.lookup({ deploymentId: "my-deployment",});ExternalApi
Section titled “ExternalApi”Source:
packages/gcp/src/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"],});ExternalApi: Looking up an existing external api
Section titled “ExternalApi: Looking up an existing external api”ExternalApi.lookup references an external api Alchemy doesn’t manage
(created in the console or by another stack). It is read during
plan/deploy, never created, updated or deleted, and binds like a declared
external api.
const externalApi = GCP.ApiHub.ExternalApi.lookup({ externalApiId: "my-external-api",});Plugin
Section titled “Plugin”Source:
packages/gcp/src/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", }, ],});Plugin: Looking up an existing plugin
Section titled “Plugin: Looking up an existing plugin”Plugin.lookup references a plugin Alchemy doesn’t manage (created in
the console or by another stack). It is read during plan/deploy, never
created, updated or deleted, and binds like a declared plugin.
const plugin = GCP.ApiHub.Plugin.lookup({ pluginId: "my-plugin" });PluginsInstance
Section titled “PluginsInstance”Source:
packages/gcp/src/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" }],});PluginsInstance: Looking up an existing plugins instance
Section titled “PluginsInstance: Looking up an existing plugins instance”PluginsInstance.lookup references a plugins instance Alchemy doesn’t
manage (created in the console or by another stack). It is read during
plan/deploy, never created, updated or deleted, and binds like a declared
plugins instance.
const pluginsInstance = GCP.ApiHub.PluginsInstance.lookup({ pluginInstanceId: "my-plugin-instance", plugin: "my-plugin",});RuntimeProjectAttachment
Section titled “RuntimeProjectAttachment”Source:
packages/gcp/src/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", },);