Skip to content

Provide apiEndpoint override option  #2928

Closed

Description

@JustinBeckwith

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

Activity

  1. stephenplusplus commented on May 22, 2019

    @stephenplusplus
    Contributor

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

  2. JustinBeckwith commented on May 23, 2019

    @JustinBeckwith
    ContributorAuthor

    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?

  3. stephenplusplus commented on May 23, 2019

    @stephenplusplus
    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.

  4. JustinBeckwith commented on Jul 23, 2019

    @JustinBeckwith
    ContributorAuthor

    We got all of this covered 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions