-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Use the universe domain if it is provided by the user #1563
base: main
Are you sure you want to change the base?
Conversation
…ejs-bigtable into universe-domain-2
servicePath: customEndpointBaseUrl || defaultAdminBaseUrl, | ||
servicePath: | ||
customEndpointBaseUrl || | ||
`bigtableadmin.${getDomain(options.BigtableTableAdminClient)}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no universe domain and custom endpoint is provided then this will still be bigtableadmin.googleapis.com.
servicePath: customEndpointBaseUrl || defaultBaseUrl, | ||
servicePath: | ||
customEndpointBaseUrl || | ||
`bigtable.${getDomain(options.BigtableClient)}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no universe domain and custom endpoint is provided then this will still be bigtable.googleapis.com.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, with a few small comments.
I'm not too familiar with the universe domains yet though, so you might also want to assign a reviewer who understands potential complications there
* @returns {string} The universe domain. | ||
*/ | ||
function getDomain(opts?: gax.ClientOptions) { | ||
// This code for universe domain was taken from the Gapic Layer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a permalink to where this came from?
servicePath: customEndpointBaseUrl || defaultBaseUrl, | ||
servicePath: | ||
customEndpointBaseUrl || | ||
`bigtable.${getDomain(options.BigtableClient)}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you think about adding pathPrefix
as an argument to getDomain (and maybe renaming the method if needed), instead of manually building the string here? I think that would be a bit easier to read, and seems more natural to me since the returned string isn't useful on its own
Summary:
The user should be able to set the universe domain so that outgoing calls work with a different Google Cloud Universe. Right now, if the user specifies a universe domain then it will not get used and the request will just be sent to the default Bigtable endpoint.
Changes:
src/index.ts:
The change here is that when a custom url is not provided, but a universe domain is provided then the servicePath will use the universe domain provided. This is done for each Gapic client and ensures requests will be made to the universe domain instead of the default Bigtable service.system-test/service-path.ts
: Two tests are added to ensure the service path is always set correctly. For instance, when a custom endpoint is provided then the service path will still always be that custom endpoint. When a custom endpoint is NOT provided, but a universe domain is provided then the service path is set to use the universe domain instead of the default endpoint.Alternatives:
universeDomain
option that would apply to all clients. While this would make things easier for users, it is an API change so it is not reversible. For now we should not change the API since users already have a way to specify the universe domains for the Gapic clients. We can always add this option later.