diff --git a/packages/google-cloud-tasks/src/v2/cloud_tasks_client.js b/packages/google-cloud-tasks/src/v2/cloud_tasks_client.js index 4cde36201ac..610063c4e30 100644 --- a/packages/google-cloud-tasks/src/v2/cloud_tasks_client.js +++ b/packages/google-cloud-tasks/src/v2/cloud_tasks_client.js @@ -56,14 +56,18 @@ class CloudTasksClient { * API remote host. */ constructor(opts) { + opts = 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 ); @@ -187,6 +191,14 @@ class CloudTasksClient { return 'cloudtasks.googleapis.com'; } + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'cloudtasks.googleapis.com'; + } + /** * The port for this API service. */ diff --git a/packages/google-cloud-tasks/src/v2beta2/cloud_tasks_client.js b/packages/google-cloud-tasks/src/v2beta2/cloud_tasks_client.js index 47efda64a81..ed8ab8c9221 100644 --- a/packages/google-cloud-tasks/src/v2beta2/cloud_tasks_client.js +++ b/packages/google-cloud-tasks/src/v2beta2/cloud_tasks_client.js @@ -56,14 +56,18 @@ class CloudTasksClient { * API remote host. */ constructor(opts) { + opts = 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 ); @@ -191,6 +195,14 @@ class CloudTasksClient { return 'cloudtasks.googleapis.com'; } + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'cloudtasks.googleapis.com'; + } + /** * The port for this API service. */ diff --git a/packages/google-cloud-tasks/src/v2beta3/cloud_tasks_client.js b/packages/google-cloud-tasks/src/v2beta3/cloud_tasks_client.js index c2f3fe1ab15..6a26c7a7942 100644 --- a/packages/google-cloud-tasks/src/v2beta3/cloud_tasks_client.js +++ b/packages/google-cloud-tasks/src/v2beta3/cloud_tasks_client.js @@ -56,14 +56,18 @@ class CloudTasksClient { * API remote host. */ constructor(opts) { + opts = 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 ); @@ -187,6 +191,14 @@ class CloudTasksClient { return 'cloudtasks.googleapis.com'; } + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'cloudtasks.googleapis.com'; + } + /** * The port for this API service. */ diff --git a/packages/google-cloud-tasks/synth.metadata b/packages/google-cloud-tasks/synth.metadata index 6218d80080b..c9d5ad23fec 100644 --- a/packages/google-cloud-tasks/synth.metadata +++ b/packages/google-cloud-tasks/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-05-21T11:26:46.540067Z", + "updateTime": "2019-06-05T14:27:56.003459Z", "sources": [ { "generator": { "name": "artman", - "version": "0.20.0", - "dockerImage": "googleapis/artman@sha256:3246adac900f4bdbd62920e80de2e5877380e44036b3feae13667ec255ebf5ec" + "version": "0.23.1", + "dockerImage": "googleapis/artman@sha256:9d5cae1454da64ac3a87028f8ef486b04889e351c83bb95e83b8fab3959faed0" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "32a10f69e2c9ce15bba13ab1ff928bacebb25160", - "internalRef": "249058354" + "sha": "47c142a7cecc6efc9f6f8af804b8be55392b795b", + "internalRef": "251635729" } }, { diff --git a/packages/google-cloud-tasks/test/gapic-v2.js b/packages/google-cloud-tasks/test/gapic-v2.js index 59c11f6b61d..8c82a3463aa 100644 --- a/packages/google-cloud-tasks/test/gapic-v2.js +++ b/packages/google-cloud-tasks/test/gapic-v2.js @@ -23,6 +23,27 @@ const error = new Error(); error.code = FAKE_STATUS_CODE; describe('CloudTasksClient', () => { + it('has servicePath', () => { + const servicePath = tasksModule.v2.CloudTasksClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tasksModule.v2.CloudTasksClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tasksModule.v2.CloudTasksClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no options', () => { + const client = new tasksModule.v2.CloudTasksClient(); + assert(client); + }); + describe('listQueues', () => { it('invokes listQueues without error', done => { const client = new tasksModule.v2.CloudTasksClient({ diff --git a/packages/google-cloud-tasks/test/gapic-v2beta2.js b/packages/google-cloud-tasks/test/gapic-v2beta2.js index 06804982b76..5637e7c90a8 100644 --- a/packages/google-cloud-tasks/test/gapic-v2beta2.js +++ b/packages/google-cloud-tasks/test/gapic-v2beta2.js @@ -23,6 +23,27 @@ const error = new Error(); error.code = FAKE_STATUS_CODE; describe('CloudTasksClient', () => { + it('has servicePath', () => { + const servicePath = tasksModule.v2beta2.CloudTasksClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tasksModule.v2beta2.CloudTasksClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tasksModule.v2beta2.CloudTasksClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no options', () => { + const client = new tasksModule.v2beta2.CloudTasksClient(); + assert(client); + }); + describe('listQueues', () => { it('invokes listQueues without error', done => { const client = new tasksModule.v2beta2.CloudTasksClient({ diff --git a/packages/google-cloud-tasks/test/gapic-v2beta3.js b/packages/google-cloud-tasks/test/gapic-v2beta3.js index a5543617f3a..4a246bab1d4 100644 --- a/packages/google-cloud-tasks/test/gapic-v2beta3.js +++ b/packages/google-cloud-tasks/test/gapic-v2beta3.js @@ -23,6 +23,27 @@ const error = new Error(); error.code = FAKE_STATUS_CODE; describe('CloudTasksClient', () => { + it('has servicePath', () => { + const servicePath = tasksModule.v2beta3.CloudTasksClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tasksModule.v2beta3.CloudTasksClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tasksModule.v2beta3.CloudTasksClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no options', () => { + const client = new tasksModule.v2beta3.CloudTasksClient(); + assert(client); + }); + describe('listQueues', () => { it('invokes listQueues without error', done => { const client = new tasksModule.v2beta3.CloudTasksClient({