From 445fe0be627de9769c5b252e77858c78682a6b8c Mon Sep 17 00:00:00 2001 From: Andy Zhao Date: Wed, 2 Dec 2020 12:22:04 -0800 Subject: [PATCH] fix(google-api-go-generator): add patch for compute mtls endpoint (#761) Compute discovery doc is currently missing MTLSRootURL since compute discovery doc is generated using old apiary pipeline, and it is not easy to fix. This is expected to be fixed after compute migrates to OP discovery doc gen in 2021. Adding a temporary patch for compute in the meantime. (Compute is the only service that has this issue, among the services we care about for MTLS.) Note that I specifically chose not to add a regex-based generic patch here in order to avoid masking MTLS endpoint issues with other services - if there are any issues, we need to triage them on a case by case basis. --- google-api-go-generator/gen.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/google-api-go-generator/gen.go b/google-api-go-generator/gen.go index 33aeaf42859..e934f836122 100644 --- a/google-api-go-generator/gen.go +++ b/google-api-go-generator/gen.go @@ -499,6 +499,11 @@ func (a *API) mtlsAPIBaseURL() string { if a.doc.MTLSRootURL != "" { return resolveRelative(a.doc.MTLSRootURL, a.doc.ServicePath) } + // TODO(andyrzhao): Remove the workaround below when MTLSRootURL becomes available in + // compute discovery doc, after compute migrates to OP discovery doc gen (ETA 2021). + if a.doc.MTLSRootURL == "" && a.doc.RootURL == "https://compute.googleapis.com/" { + return resolveRelative("https://compute.mtls.googleapis.com/", a.doc.ServicePath) + } return "" }