feat(gcp): API Gateway apis + configs + gateways - #1257
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Google API Gateway control plane (
apigateway.googleapis.com) as a new GCP wire service:apis, theirapiConfigs, andgateways, 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 thegoogle-betaprovider, whose default base path isapigateway.googleapis.com/v1beta/(confirmed against the live v1beta discovery doc — note it isv1beta, notv1beta1). The handler is version-aware and serves both/v1beta/and/v1/(a realgoogle.golang.org/api/apigateway/v1client / gcloud). The completed-operationresponsecarries 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
Operation{done:true}with the resource embedded as a typedAny, so a Terraform/SDK wait terminates on the first poll.name,createTime,state(seededACTIVE), plusserviceConfigId(config) anddefaultHostname(gateway) minted once at create, stored, and stable across reads.openapi_documentscontentsround-trip byte-for-byte via raw passthrough.apis/{api}/configs; creating a config validates its parent api (404); creating a gateway validates itsapiConfigreference (404). Deleting an api cascades to its configs with a trailing-slash-bounded prefix scan (deletinga1never touchesa10).updateMasktop-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/driveris 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 inservices/apigatewaygcp/driver. The provider/server package dirs stayapigateway(distinct import trees undergcp/vsaws/), and the generated GCP page is stilldocs/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-betaprovider,/v1beta/)Served on
:18063,api_gateway_custom_endpoint = http://127.0.0.1:18063/v1beta/, providerhashicorp/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-exitcode→ exit 0, no drift (name / service_config_id / default_hostname / openapi contents all stable).display_name+labelson all three → applied (api via PATCH);plan→ exit 0; computed fields unchanged.destroy→ 3 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 ./..., fullgo vet ./...,gofmt,golangci-linton new+wired pkgs (0 issues),go test -racenew pkgs, fullgo test ./server/gcp/...(no sibling operations-404 regression),go test ./providers/...,go test ./persist/...(completeness),go test ., andgo generateidempotency — all green. Docs regenerated: only the newgcp/apigateway.md+ shared indexes; AWSapigateway.mduntouched.