Skip to content

feat(gcp): API Gateway apis + configs + gateways - #1257

Merged
NitinKumar004 merged 1 commit into
developmentfrom
feat/gcp-apigateway
Sep 7, 2026
Merged

feat(gcp): API Gateway apis + configs + gateways#1257
NitinKumar004 merged 1 commit into
developmentfrom
feat/gcp-apigateway

Conversation

@NitinKumar004

Copy link
Copy Markdown
Collaborator

Summary

Adds the Google API Gateway control plane (apigateway.googleapis.com) as a new GCP wire service: apis, their apiConfigs, and gateways, plus the long-running operations their mutating RPCs return. Control-plane only (no data plane / request routing).

Provider tier — google-beta, /v1beta/

API Gateway's Terraform resources (google_api_gateway_api, google_api_gateway_api_config, google_api_gateway_gateway) exist only in the google-beta provider, whose default base path is apigateway.googleapis.com/v1beta/ (confirmed against the live v1beta discovery doc — note it is v1beta, not v1beta1). The handler is version-aware and serves both /v1beta/ and /v1/ (a real google.golang.org/api/apigateway/v1 client / gcloud). The completed-operation response carries a version-matched @type (…apigateway.v1beta.* vs …apigateway.v1.*).

Because the shared GCP LRO poller only owns the /v1/ operations space, and the google-beta provider polls operations at its /v1beta/ base path, the handler serves its own /v1beta/ operation polls and yields the /v1/ ones to the shared poller (still registering created ops there so a /v1/ SDK poll resolves the typed response).

Behavior

  • LRO resolve-immediately: every mutation returns Operation{done:true} with the resource embedded as a typed Any, so a Terraform/SDK wait terminates on the first poll.
  • Computed-field stability (drift points): name, createTime, state (seeded ACTIVE), plus serviceConfigId (config) and defaultHostname (gateway) minted once at create, stored, and stable across reads. openapi_documents contents round-trip byte-for-byte via raw passthrough.
  • Hierarchy + cascade: configs nest under apis/{api}/configs; creating a config validates its parent api (404); creating a gateway validates its apiConfig reference (404). Deleting an api cascades to its configs with a trailing-slash-bounded prefix scan (deleting a1 never touches a10).
  • updateMask top-level replace; unmasked fields survive. Client-named create via ?apiId=/?apiConfigId=/?gatewayId= (body-name fallback). COW memstore, deep clone on read, Snapshottable.

Note on layout

services/apigateway/driver is already the AWS Amazon API Gateway (REST-API-v1) service — a wholly different API. To avoid corrupting coveragegen (one service dir = one primary interface), the GCP portable driver lives in services/apigatewaygcp/driver. The provider/server package dirs stay apigateway (distinct import trees under gcp/ vs aws/), and the generated GCP page is still docs/coverage/gcp/apigateway.md (page name derives from the provider field, not the service dir). The AWS driver is untouched.

Terraform plan-clean e2e (real google-beta provider, /v1beta/)

Served on :18063, api_gateway_custom_endpoint = http://127.0.0.1:18063/v1beta/, provider hashicorp/google-beta v8.1.0:

  • apply — an api + an api_config (openapi document, labels) + a gateway referencing the config → 3 added, LRO did not hang, all states ACTIVE.
  • plan -detailed-exitcodeexit 0, no drift (name / service_config_id / default_hostname / openapi contents all stable).
  • update display_name + labels on all three → applied (api via PATCH); planexit 0; computed fields unchanged.
  • destroy3 destroyed; api/config/gateway all 404 (cascade verified).

Outputs on apply: api_name = projects/cloudemu-local/locations/global/apis/my-api, service_config_id = my-config-ba0fb7c7, default_hostname = my-gw-dfb2df49.us-central1.gateway.dev.

Gates (GOMAXPROCS=3)

go build ./..., full go vet ./..., gofmt, golangci-lint on new+wired pkgs (0 issues), go test -race new pkgs, full go test ./server/gcp/... (no sibling operations-404 regression), go test ./providers/..., go test ./persist/... (completeness), go test ., and go generate idempotency — all green. Docs regenerated: only the new gcp/apigateway.md + shared indexes; AWS apigateway.md untouched.

@NitinKumar004
NitinKumar004 merged commit 4ba0ae3 into development Sep 7, 2026
23 checks passed
@NitinKumar004
NitinKumar004 deleted the feat/gcp-apigateway branch September 7, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant