Skip to content
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

Provide apiEndpoint override option #2928

Closed
47 of 51 tasks
JustinBeckwith opened this issue May 22, 2019 · 4 comments
Closed
47 of 51 tasks

Provide apiEndpoint override option #2928

JustinBeckwith opened this issue May 22, 2019 · 4 comments
Assignees
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@JustinBeckwith
Copy link
Contributor

JustinBeckwith commented May 22, 2019

For each API, we should support overriding the API endpoint to be used via the apiEndpoint property passed into the constructor options.

High level blocking issues:

Per-API issues:

GAPIC generated

  • googleapis/nodejs-asset
  • googleapis/nodejs-automl
  • googleapis/nodejs-bigquery-data-transfer
  • googleapis/nodejs-cloud-container
  • googleapis/nodejs-containeranalysis
  • googleapis/nodejs-datalabeling
  • googleapis/nodejs-dataproc
  • googleapis/nodejs-dialogflow
  • googleapis/nodejs-dlp
  • googleapis/nodejs-iot
  • googleapis/nodejs-irm
  • googleapis/nodejs-kms
  • googleapis/nodejs-language
  • googleapis/nodejs-monitoring
  • googleapis/nodejs-os-login
  • googleapis/nodejs-recaptcha-enterprise
  • googleapis/nodejs-redis
  • googleapis/nodejs-scheduler
  • googleapis/nodejs-security-center
  • googleapis/nodejs-speech
  • googleapis/nodejs-talent
  • googleapis/nodejs-tasks
  • googleapis/nodejs-text-to-speech
  • googleapis/nodejs-web-risk
  • googleapis/nodejs-video-intelligence
  • googleapis/nodejs-vision
@JustinBeckwith JustinBeckwith self-assigned this May 22, 2019
@JustinBeckwith JustinBeckwith added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label May 22, 2019
@stephenplusplus
Copy link
Contributor

We used to have this in common! Did we lose it?

@JustinBeckwith
Copy link
Contributor Author

Oh bother - I appear to have missed this one 😆 I see that we handle the customEndpoint property in the MakeAuthenticatedRequestConfig interface, but it I don't think (need to look deeper) it's actually documented in any of the jsdoc or interfaces we provide. The hand written libs that sit over nodejs-common-grpc do provide this, but kinda all handle it manually.

The plan is different based on the type of lib, but my thinking was that in the ones that sit on nodejs-common we would do something like this:

constructor(options: StorageOptions = {}) {
   options.apiEndpoint = options.apiEndpoint ||'www.googleapis.com';
   const config = {
     baseUrl: `https://${options.apiEndpoint}/storage/v1`,
     projectIdRequired: false,
     scopes: [
       'https://www.googleapis.com/auth/cloud-platform',
       'https://www.googleapis.com/auth/devstorage.full_control',
     ],
     packageJson: require('../../package.json'),
   };
   super(config, options);
}

Does this seem like a good approach?

@stephenplusplus
Copy link
Contributor

That looks right to me! We can talk specific implementation when PR time comes, but we might want to make sure to cover also handling them separately, like host and port.

@JustinBeckwith
Copy link
Contributor Author

We got all of this covered 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants