diff --git a/packages/google-cloud-compute/package.json b/packages/google-cloud-compute/package.json index 513ef69121e..c60dda198d9 100644 --- a/packages/google-cloud-compute/package.json +++ b/packages/google-cloud-compute/package.json @@ -35,7 +35,7 @@ "predocs-test": "npm run docs" }, "dependencies": { - "@google-cloud/common": "^2.0.0", + "@google-cloud/common": "^2.3.0", "@google-cloud/paginator": "^2.0.0", "@google-cloud/projectify": "^1.0.0", "@google-cloud/promisify": "^1.0.0", diff --git a/packages/google-cloud-compute/src/address.js b/packages/google-cloud-compute/src/address.js index ac8e3c30dc6..7ff95bb3a18 100644 --- a/packages/google-cloud-compute/src/address.js +++ b/packages/google-cloud-compute/src/address.js @@ -162,6 +162,7 @@ class Address extends common.ServiceObject { id: name, createMethod: region.createAddress.bind(region), methods: methods, + pollIntervalMs: region.compute.pollIntervalMs, }); /** * @name Address#name diff --git a/packages/google-cloud-compute/src/autoscaler.js b/packages/google-cloud-compute/src/autoscaler.js index d37b1308abf..62e794b4d69 100644 --- a/packages/google-cloud-compute/src/autoscaler.js +++ b/packages/google-cloud-compute/src/autoscaler.js @@ -177,6 +177,7 @@ class Autoscaler extends common.ServiceObject { id: name, createMethod: zone.createAutoscaler.bind(zone), methods: methods, + pollIntervalMs: zone.compute.pollIntervalMs, }); /** * @name Autoscaler#name diff --git a/packages/google-cloud-compute/src/disk.js b/packages/google-cloud-compute/src/disk.js index dc34a90dfae..7a758b2ece8 100644 --- a/packages/google-cloud-compute/src/disk.js +++ b/packages/google-cloud-compute/src/disk.js @@ -172,6 +172,7 @@ class Disk extends common.ServiceObject { id: name, createMethod: zone.createDisk.bind(zone), methods: methods, + pollIntervalMs: zone.compute.pollIntervalMs, }); /** * @name Disk#name diff --git a/packages/google-cloud-compute/src/firewall.js b/packages/google-cloud-compute/src/firewall.js index 6b76b20726a..313de5480c2 100644 --- a/packages/google-cloud-compute/src/firewall.js +++ b/packages/google-cloud-compute/src/firewall.js @@ -165,6 +165,7 @@ class Firewall extends common.ServiceObject { id: name, createMethod: compute.createFirewall.bind(compute), methods: methods, + pollIntervalMs: compute.pollIntervalMs, }); /** * The parent {@link Compute} instance of this {@link Firewall} instance. diff --git a/packages/google-cloud-compute/src/health-check.js b/packages/google-cloud-compute/src/health-check.js index 153d3e646cd..6825d98ab36 100644 --- a/packages/google-cloud-compute/src/health-check.js +++ b/packages/google-cloud-compute/src/health-check.js @@ -181,6 +181,7 @@ class HealthCheck extends common.ServiceObject { compute.createHealthCheck(name, options, callback); }, methods: methods, + pollIntervalMs: compute.pollIntervalMs, }); /** * The parent {@link Compute} instance of this {@link HealthCheck} instance. diff --git a/packages/google-cloud-compute/src/image.js b/packages/google-cloud-compute/src/image.js index 4b134517512..35c650ba271 100644 --- a/packages/google-cloud-compute/src/image.js +++ b/packages/google-cloud-compute/src/image.js @@ -156,6 +156,7 @@ class Image extends common.ServiceObject { id: name, createMethod: compute.createImage.bind(compute), methods: methods, + pollIntervalMs: compute.pollIntervalMs, }); } /** diff --git a/packages/google-cloud-compute/src/index.js b/packages/google-cloud-compute/src/index.js index b639112ce26..829c665c715 100644 --- a/packages/google-cloud-compute/src/index.js +++ b/packages/google-cloud-compute/src/index.js @@ -56,6 +56,8 @@ const Image = require('./image.js'); * We will exponentially backoff subsequent requests by default. * @property {number} [maxRetries=3] Maximum number of automatic retries * attempted before returning the error. + * @property {number} [pollIntervalMs=500] Poll interval for long running + * operations. * @property {Constructor} [promise] Custom promise module to use instead of * native Promises. * @property {string} [apiEndpoint] The API endpoint of the service used to make requests. Defaults to `compute.googleapis.com` @@ -88,6 +90,7 @@ class Compute extends common.Service { packageJson: require('../package.json'), }; super(config, options); + this.pollIntervalMs = options.pollIntervalMs; } /** * Create a firewall. diff --git a/packages/google-cloud-compute/src/instance-group-manager.js b/packages/google-cloud-compute/src/instance-group-manager.js index e1aa0119cf3..64902b0bcb4 100644 --- a/packages/google-cloud-compute/src/instance-group-manager.js +++ b/packages/google-cloud-compute/src/instance-group-manager.js @@ -140,6 +140,7 @@ class InstanceGroupManager extends common.ServiceObject { id: name, // createMethod: zone.createInstanceGroupManager.bind(zone), methods: methods, + pollIntervalMs: zone.compute.pollIntervalMs, }); /** * The parent {@link Zone} instance of this {@link InstanceGroup} instance. diff --git a/packages/google-cloud-compute/src/instance-group.js b/packages/google-cloud-compute/src/instance-group.js index 4ea3a2f57b2..049f616faec 100644 --- a/packages/google-cloud-compute/src/instance-group.js +++ b/packages/google-cloud-compute/src/instance-group.js @@ -172,6 +172,7 @@ class InstanceGroup extends common.ServiceObject { id: name, createMethod: zone.createInstanceGroup.bind(zone), methods: methods, + pollIntervalMs: zone.compute.pollIntervalMs, }); /** * The parent {@link Zone} instance of this {@link InstanceGroup} instance. diff --git a/packages/google-cloud-compute/src/machine-type.js b/packages/google-cloud-compute/src/machine-type.js index ed55a6c3ea9..39f0f54174a 100644 --- a/packages/google-cloud-compute/src/machine-type.js +++ b/packages/google-cloud-compute/src/machine-type.js @@ -128,6 +128,7 @@ class MachineType extends common.ServiceObject { */ id: name, methods: methods, + pollIntervalMs: zone.compute.pollIntervalMs, }); /** * The parent {@link Zone} instance of this {@link MachineType} instance. diff --git a/packages/google-cloud-compute/src/network.js b/packages/google-cloud-compute/src/network.js index 86220dd311e..c31f5deee9e 100644 --- a/packages/google-cloud-compute/src/network.js +++ b/packages/google-cloud-compute/src/network.js @@ -167,6 +167,7 @@ class Network extends common.ServiceObject { id: name, createMethod: compute.createNetwork.bind(compute), methods: methods, + pollIntervalMs: compute.pollIntervalMs, }); /** * The parent {@link Compute} instance of this {@link Network} instance. diff --git a/packages/google-cloud-compute/src/operation.js b/packages/google-cloud-compute/src/operation.js index 7cf4e53c7f8..e4732583804 100644 --- a/packages/google-cloud-compute/src/operation.js +++ b/packages/google-cloud-compute/src/operation.js @@ -174,6 +174,9 @@ class Operation extends common.Operation { */ id: name, methods: methods, + pollIntervalMs: isCompute + ? scope.pollIntervalMs + : scope.compute.pollIntervalMs, }); /** diff --git a/packages/google-cloud-compute/src/project.js b/packages/google-cloud-compute/src/project.js index d6ad6aadac5..e263a0149ee 100644 --- a/packages/google-cloud-compute/src/project.js +++ b/packages/google-cloud-compute/src/project.js @@ -95,6 +95,7 @@ class Project extends common.ServiceObject { baseUrl: '', id: '', methods: methods, + pollIntervalMs: compute.pollIntervalMs, }); } } diff --git a/packages/google-cloud-compute/src/region.js b/packages/google-cloud-compute/src/region.js index ecd356c427f..3816d5e5a4e 100644 --- a/packages/google-cloud-compute/src/region.js +++ b/packages/google-cloud-compute/src/region.js @@ -131,12 +131,14 @@ class Region extends common.ServiceObject { */ id: name, methods: methods, + pollIntervalMs: compute.pollIntervalMs, }); /** * @name Region#name * @type {string} */ this.name = name; + this.compute = compute; this.interceptors.push({ request: function(reqOpts) { if (reqOpts.uri.indexOf('/global/forwardingRules') > -1) { diff --git a/packages/google-cloud-compute/src/rule.js b/packages/google-cloud-compute/src/rule.js index 5328224aa63..b0bb148d62c 100644 --- a/packages/google-cloud-compute/src/rule.js +++ b/packages/google-cloud-compute/src/rule.js @@ -186,6 +186,9 @@ class Rule extends common.ServiceObject { id: name, createMethod: scope.createRule.bind(scope), methods: methods, + pollIntervalMs: scope.compute + ? scope.compute.pollIntervalMs + : scope.pollIntervalMs, }); /** * @name Rule#scope diff --git a/packages/google-cloud-compute/src/service.js b/packages/google-cloud-compute/src/service.js index ba0756860d5..e828d520e7b 100644 --- a/packages/google-cloud-compute/src/service.js +++ b/packages/google-cloud-compute/src/service.js @@ -181,6 +181,7 @@ class Service extends common.ServiceObject { id: name, createMethod: compute.createService.bind(compute), methods: methods, + pollIntervalMs: compute.pollIntervalMs, }); /** * The parent {@link Compute} instance of this {@link Service} instance. diff --git a/packages/google-cloud-compute/src/snapshot.js b/packages/google-cloud-compute/src/snapshot.js index 9d700a5cf47..807e2644087 100644 --- a/packages/google-cloud-compute/src/snapshot.js +++ b/packages/google-cloud-compute/src/snapshot.js @@ -134,6 +134,7 @@ class Snapshot extends common.ServiceObject { */ id: name, methods: methods, + pollIntervalMs: compute.pollIntervalMs, }; if (isDisk) { config.createMethod = scope.createSnapshot.bind(scope); diff --git a/packages/google-cloud-compute/src/subnetwork.js b/packages/google-cloud-compute/src/subnetwork.js index 80fe79e9485..10708d1d776 100644 --- a/packages/google-cloud-compute/src/subnetwork.js +++ b/packages/google-cloud-compute/src/subnetwork.js @@ -168,6 +168,7 @@ class Subnetwork extends common.ServiceObject { id: name, createMethod: region.createSubnetwork.bind(region), methods: methods, + pollIntervalMs: region.compute.pollIntervalMs, }); /** * @name Subnetwork#name diff --git a/packages/google-cloud-compute/src/vm.js b/packages/google-cloud-compute/src/vm.js index 3c79e4869d8..f2b42ec392c 100644 --- a/packages/google-cloud-compute/src/vm.js +++ b/packages/google-cloud-compute/src/vm.js @@ -233,6 +233,7 @@ class VM extends common.ServiceObject { id: name, createMethod: zone.createVM.bind(zone), methods: methods, + pollIntervalMs: zone.compute.pollIntervalMs, }); /** diff --git a/packages/google-cloud-compute/src/zone.js b/packages/google-cloud-compute/src/zone.js index 3f965904134..fa1497937b5 100644 --- a/packages/google-cloud-compute/src/zone.js +++ b/packages/google-cloud-compute/src/zone.js @@ -138,6 +138,7 @@ class Zone extends common.ServiceObject { */ id: name, methods: methods, + pollIntervalMs: compute.pollIntervalMs, }); /** * The parent {@link Compute} instance of this {@link Zone} instance. diff --git a/packages/google-cloud-compute/test/address.js b/packages/google-cloud-compute/test/address.js index e0eb00643fd..ff6891d86c7 100644 --- a/packages/google-cloud-compute/test/address.js +++ b/packages/google-cloud-compute/test/address.js @@ -42,6 +42,7 @@ describe('Address', function() { const ADDRESS_NAME = 'us-central1'; const REGION = { createAddress: () => {}, + compute: {}, }; before(function() { diff --git a/packages/google-cloud-compute/test/instance-group-manager.js b/packages/google-cloud-compute/test/instance-group-manager.js index a1f8952a7cf..01439c42632 100644 --- a/packages/google-cloud-compute/test/instance-group-manager.js +++ b/packages/google-cloud-compute/test/instance-group-manager.js @@ -41,7 +41,9 @@ describe('InstanceGroupManager', function() { const staticMethods = {}; - const ZONE = {}; + const ZONE = { + compute: {}, + }; const NAME = 'instance-group-manager-name'; before(function() { diff --git a/packages/google-cloud-compute/test/instance-group.js b/packages/google-cloud-compute/test/instance-group.js index b4b9fa4dd3e..c70bd1c4e4d 100644 --- a/packages/google-cloud-compute/test/instance-group.js +++ b/packages/google-cloud-compute/test/instance-group.js @@ -64,6 +64,7 @@ describe('InstanceGroup', function() { const ZONE = { createInstanceGroup: util.noop, vm: util.noop, + compute: {}, }; const NAME = 'instance-group-name'; diff --git a/packages/google-cloud-compute/test/machine-type.js b/packages/google-cloud-compute/test/machine-type.js index 7e8931af65e..18495c2563e 100644 --- a/packages/google-cloud-compute/test/machine-type.js +++ b/packages/google-cloud-compute/test/machine-type.js @@ -31,6 +31,7 @@ describe('MachineType', function() { const ZONE_NAME = 'zone-1'; const ZONE = { name: ZONE_NAME, + compute: {}, }; const MACHINE_TYPE_NAME = 'g1-small'; diff --git a/packages/google-cloud-compute/test/operation.js b/packages/google-cloud-compute/test/operation.js index faa660c8e61..9b976e0fe5c 100644 --- a/packages/google-cloud-compute/test/operation.js +++ b/packages/google-cloud-compute/test/operation.js @@ -56,6 +56,7 @@ describe('Operation', function() { const SCOPE = { Promise: Promise, + compute: {}, }; const OPERATION_NAME = 'operation-name'; diff --git a/packages/google-cloud-compute/test/subnetwork.js b/packages/google-cloud-compute/test/subnetwork.js index 2f698562f8a..474b9c630ca 100644 --- a/packages/google-cloud-compute/test/subnetwork.js +++ b/packages/google-cloud-compute/test/subnetwork.js @@ -44,6 +44,7 @@ describe('Subnetwork', function() { const REGION = { createSubnetwork: util.noop, name: REGION_NAME, + compute: {}, }; before(function() {