From 70c9fe8c93802d312892e3fe2f5f5b3de44285ac Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 4 Jun 2019 13:28:39 -0700 Subject: [PATCH] feat: support apiEndpoint override in client constructor (#204) --- .../src/v1beta/os_login_service_client.js | 13 ++++++++++++- packages/google-cloud-oslogin/synth.metadata | 10 +++++----- .../google-cloud-oslogin/test/gapic-v1beta.js | 16 ++++++++++++++++ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.js b/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.js index cccd3efd228c..efeab6aaea00 100644 --- a/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.js +++ b/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.js @@ -60,12 +60,15 @@ class OsLoginServiceClient { constructor(opts) { this._descriptors = {}; + const servicePath = + opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; + // Ensure that options include the service address and port. opts = Object.assign( { clientConfig: {}, port: this.constructor.port, - servicePath: this.constructor.servicePath, + servicePath, }, opts ); @@ -164,6 +167,14 @@ class OsLoginServiceClient { return 'oslogin.googleapis.com'; } + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'oslogin.googleapis.com'; + } + /** * The port for this API service. */ diff --git a/packages/google-cloud-oslogin/synth.metadata b/packages/google-cloud-oslogin/synth.metadata index 6ecca8fd06a6..68e31bc612c1 100644 --- a/packages/google-cloud-oslogin/synth.metadata +++ b/packages/google-cloud-oslogin/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-05-21T11:20:14.671818Z", + "updateTime": "2019-06-04T19:38:15.784953Z", "sources": [ { "generator": { "name": "artman", - "version": "0.20.0", - "dockerImage": "googleapis/artman@sha256:3246adac900f4bdbd62920e80de2e5877380e44036b3feae13667ec255ebf5ec" + "version": "0.23.0", + "dockerImage": "googleapis/artman@sha256:846102ebf7ea2239162deea69f64940443b4147f7c2e68d64b332416f74211ba" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "32a10f69e2c9ce15bba13ab1ff928bacebb25160", - "internalRef": "249058354" + "sha": "0026f4b890ed9e2388fb0573c0727defa6f5b82e", + "internalRef": "251265049" } }, { diff --git a/packages/google-cloud-oslogin/test/gapic-v1beta.js b/packages/google-cloud-oslogin/test/gapic-v1beta.js index 7bc7ff33a288..355c8a30873c 100644 --- a/packages/google-cloud-oslogin/test/gapic-v1beta.js +++ b/packages/google-cloud-oslogin/test/gapic-v1beta.js @@ -23,6 +23,22 @@ const error = new Error(); error.code = FAKE_STATUS_CODE; describe('OsLoginServiceClient', () => { + it('has servicePath', () => { + const servicePath = osLoginModule.v1beta.OsLoginServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = osLoginModule.v1beta.OsLoginServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = osLoginModule.v1beta.OsLoginServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + describe('deletePosixAccount', () => { it('invokes deletePosixAccount without error', done => { const client = new osLoginModule.v1beta.OsLoginServiceClient({