Skip to content

Commit 197e6e0

Browse files
chore(deps): use @google-cloud/paginator (#173)
1 parent 8e61c8a commit 197e6e0

File tree

9 files changed

+125
-137
lines changed

9 files changed

+125
-137
lines changed

packages/google-cloud-compute/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
},
6565
"dependencies": {
6666
"@google-cloud/common": "^0.17.0",
67+
"@google-cloud/paginator": "^0.1.1",
6768
"@google-cloud/promisify": "^0.3.1",
6869
"arrify": "^1.0.1",
6970
"async": "^2.6.1",

packages/google-cloud-compute/src/index.js

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const format = require('string-format-obj');
2323
const is = require('is');
2424
const util = require('util');
2525
const {promisifyAll} = require('@google-cloud/promisify');
26+
const {paginator} = require('@google-cloud/paginator');
2627

2728
const Firewall = require('./firewall.js');
2829
const HealthCheck = require('./health-check.js');
@@ -809,9 +810,7 @@ Compute.prototype.getAddresses = function(options, callback) {
809810
* this.end();
810811
* });
811812
*/
812-
Compute.prototype.getAddressesStream = common.paginator.streamify(
813-
'getAddresses'
814-
);
813+
Compute.prototype.getAddressesStream = paginator.streamify('getAddresses');
815814

816815
/**
817816
* Get a list of autoscalers. For a detailed description of this method's
@@ -948,9 +947,7 @@ Compute.prototype.getAutoscalers = function(options, callback) {
948947
* this.end();
949948
* });
950949
*/
951-
Compute.prototype.getAutoscalersStream = common.paginator.streamify(
952-
'getAutoscalers'
953-
);
950+
Compute.prototype.getAutoscalersStream = paginator.streamify('getAutoscalers');
954951

955952
/**
956953
* Get a list of disks.
@@ -1082,7 +1079,7 @@ Compute.prototype.getDisks = function(options, callback) {
10821079
* });
10831080
*/
10841081

1085-
Compute.prototype.getDisksStream = common.paginator.streamify('getDisks');
1082+
Compute.prototype.getDisksStream = paginator.streamify('getDisks');
10861083

10871084
/**
10881085
* Get a list of instance groups.
@@ -1216,7 +1213,7 @@ Compute.prototype.getInstanceGroups = function(options, callback) {
12161213
* });
12171214
*/
12181215

1219-
Compute.prototype.getInstanceGroupsStream = common.paginator.streamify(
1216+
Compute.prototype.getInstanceGroupsStream = paginator.streamify(
12201217
'getInstanceGroups'
12211218
);
12221219

@@ -1337,9 +1334,7 @@ Compute.prototype.getFirewalls = function(options, callback) {
13371334
* this.end();
13381335
* });
13391336
*/
1340-
Compute.prototype.getFirewallsStream = common.paginator.streamify(
1341-
'getFirewalls'
1342-
);
1337+
Compute.prototype.getFirewallsStream = paginator.streamify('getFirewalls');
13431338

13441339
/**
13451340
* Get a list of health checks.
@@ -1467,7 +1462,7 @@ Compute.prototype.getHealthChecks = function(options, callback) {
14671462
* this.end();
14681463
* });
14691464
*/
1470-
Compute.prototype.getHealthChecksStream = common.paginator.streamify(
1465+
Compute.prototype.getHealthChecksStream = paginator.streamify(
14711466
'getHealthChecks'
14721467
);
14731468

@@ -1587,7 +1582,7 @@ Compute.prototype.getImages = function(options, callback) {
15871582
* this.end();
15881583
* });
15891584
*/
1590-
Compute.prototype.getImagesStream = common.paginator.streamify('getImages');
1585+
Compute.prototype.getImagesStream = paginator.streamify('getImages');
15911586

15921587
/**
15931588
* Get a list of machine types in this project.
@@ -1721,7 +1716,7 @@ Compute.prototype.getMachineTypes = function(options, callback) {
17211716
* this.end();
17221717
* });
17231718
*/
1724-
Compute.prototype.getMachineTypesStream = common.paginator.streamify(
1719+
Compute.prototype.getMachineTypesStream = paginator.streamify(
17251720
'getMachineTypes'
17261721
);
17271722

@@ -1845,7 +1840,7 @@ Compute.prototype.getNetworks = function(options, callback) {
18451840
* this.end();
18461841
* });
18471842
*/
1848-
Compute.prototype.getNetworksStream = common.paginator.streamify('getNetworks');
1843+
Compute.prototype.getNetworksStream = paginator.streamify('getNetworks');
18491844

18501845
/**
18511846
* Get a list of global operations.
@@ -1968,9 +1963,7 @@ Compute.prototype.getOperations = function(options, callback) {
19681963
* this.end();
19691964
* });
19701965
*/
1971-
Compute.prototype.getOperationsStream = common.paginator.streamify(
1972-
'getOperations'
1973-
);
1966+
Compute.prototype.getOperationsStream = paginator.streamify('getOperations');
19741967

19751968
/**
19761969
* Return the regions available to your project.
@@ -2091,7 +2084,7 @@ Compute.prototype.getRegions = function(options, callback) {
20912084
* this.end();
20922085
* });
20932086
*/
2094-
Compute.prototype.getRegionsStream = common.paginator.streamify('getRegions');
2087+
Compute.prototype.getRegionsStream = paginator.streamify('getRegions');
20952088

20962089
/**
20972090
* Get a list of forwarding rules.
@@ -2212,7 +2205,7 @@ Compute.prototype.getRules = function(options, callback) {
22122205
* this.end();
22132206
* });
22142207
*/
2215-
Compute.prototype.getRulesStream = common.paginator.streamify('getRules');
2208+
Compute.prototype.getRulesStream = paginator.streamify('getRules');
22162209

22172210
/**
22182211
* Get a list of backend services.
@@ -2334,7 +2327,7 @@ Compute.prototype.getServices = function(options, callback) {
23342327
* this.end();
23352328
* });
23362329
*/
2337-
Compute.prototype.getServicesStream = common.paginator.streamify('getServices');
2330+
Compute.prototype.getServicesStream = paginator.streamify('getServices');
23382331

23392332
/**
23402333
* Get a list of snapshots.
@@ -2456,9 +2449,7 @@ Compute.prototype.getSnapshots = function(options, callback) {
24562449
* this.end();
24572450
* });
24582451
*/
2459-
Compute.prototype.getSnapshotsStream = common.paginator.streamify(
2460-
'getSnapshots'
2461-
);
2452+
Compute.prototype.getSnapshotsStream = paginator.streamify('getSnapshots');
24622453

24632454
/**
24642455
* Get a list of subnetworks in this project.
@@ -2594,9 +2585,7 @@ Compute.prototype.getSubnetworks = function(options, callback) {
25942585
* this.end();
25952586
* });
25962587
*/
2597-
Compute.prototype.getSubnetworksStream = common.paginator.streamify(
2598-
'getSubnetworks'
2599-
);
2588+
Compute.prototype.getSubnetworksStream = paginator.streamify('getSubnetworks');
26002589

26012590
/**
26022591
* Get a list of virtual machine instances.
@@ -2726,7 +2715,7 @@ Compute.prototype.getVMs = function(options, callback) {
27262715
* this.end();
27272716
* });
27282717
*/
2729-
Compute.prototype.getVMsStream = common.paginator.streamify('getVMs');
2718+
Compute.prototype.getVMsStream = paginator.streamify('getVMs');
27302719

27312720
/**
27322721
* Return the zones available to your project.
@@ -2847,7 +2836,7 @@ Compute.prototype.getZones = function(options, callback) {
28472836
* this.end();
28482837
* });
28492838
*/
2850-
Compute.prototype.getZonesStream = common.paginator.streamify('getZones');
2839+
Compute.prototype.getZonesStream = paginator.streamify('getZones');
28512840

28522841
/**
28532842
* Get a reference to a Google Compute Engine health check.
@@ -3035,7 +3024,7 @@ Compute.prototype.execAfterOperation_ = function(callback) {
30353024
*
30363025
* These methods can be auto-paginated.
30373026
*/
3038-
common.paginator.extend(Compute, [
3027+
paginator.extend(Compute, [
30393028
'getAddresses',
30403029
'getAutoscalers',
30413030
'getDisks',

packages/google-cloud-compute/src/instance-group.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const extend = require('extend');
2222
const is = require('is');
2323
const util = require('util');
2424
const {promisifyAll} = require('@google-cloud/promisify');
25+
const {paginator} = require('@google-cloud/paginator');
2526

2627
/**
2728
* You can create and manage groups of virtual machine instances so that you
@@ -466,7 +467,7 @@ InstanceGroup.prototype.getVMs = function(options, callback) {
466467
* this.end();
467468
* });
468469
*/
469-
InstanceGroup.prototype.getVMsStream = common.paginator.streamify('getVMs');
470+
InstanceGroup.prototype.getVMsStream = paginator.streamify('getVMs');
470471

471472
/**
472473
* Remove one or more VMs from this instance group.
@@ -602,7 +603,7 @@ InstanceGroup.prototype.setPorts = function(ports, callback) {
602603
*
603604
* These methods can be auto-paginated.
604605
*/
605-
common.paginator.extend(InstanceGroup, ['getVMs']);
606+
paginator.extend(InstanceGroup, ['getVMs']);
606607

607608
/*! Developer Documentation
608609
*

packages/google-cloud-compute/src/region.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const extend = require('extend');
2121
const is = require('is');
2222
const util = require('util');
2323
const {promisifyAll} = require('@google-cloud/promisify');
24+
const {paginator} = require('@google-cloud/paginator');
2425

2526
const Address = require('./address.js');
2627
const Network = require('./network.js');
@@ -529,9 +530,7 @@ Region.prototype.getAddresses = function(options, callback) {
529530
* this.end();
530531
* });
531532
*/
532-
Region.prototype.getAddressesStream = common.paginator.streamify(
533-
'getAddresses'
534-
);
533+
Region.prototype.getAddressesStream = paginator.streamify('getAddresses');
535534

536535
/**
537536
* Get a list of operations for this region.
@@ -661,9 +660,7 @@ Region.prototype.getOperations = function(options, callback) {
661660
* this.end();
662661
* });
663662
*/
664-
Region.prototype.getOperationsStream = common.paginator.streamify(
665-
'getOperations'
666-
);
663+
Region.prototype.getOperationsStream = paginator.streamify('getOperations');
667664

668665
/**
669666
* Get a list of forwading rules in this region.
@@ -792,7 +789,7 @@ Region.prototype.getRules = function(options, callback) {
792789
* this.end();
793790
* });
794791
*/
795-
Region.prototype.getRulesStream = common.paginator.streamify('getRules');
792+
Region.prototype.getRulesStream = paginator.streamify('getRules');
796793

797794
/**
798795
* Get a list of subnetworks in this region.
@@ -922,9 +919,7 @@ Region.prototype.getSubnetworks = function(options, callback) {
922919
* this.end();
923920
* });
924921
*/
925-
Region.prototype.getSubnetworksStream = common.paginator.streamify(
926-
'getSubnetworks'
927-
);
922+
Region.prototype.getSubnetworksStream = paginator.streamify('getSubnetworks');
928923

929924
/**
930925
* Get a reference to a Google Compute Engine region operation.
@@ -985,7 +980,7 @@ Region.prototype.subnetwork = function(name) {
985980
*
986981
* These methods can be auto-paginated.
987982
*/
988-
common.paginator.extend(Region, [
983+
paginator.extend(Region, [
989984
'getAddresses',
990985
'getOperations',
991986
'getRules',

packages/google-cloud-compute/src/zone.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const gceImages = require('gce-images');
2525
const is = require('is');
2626
const util = require('util');
2727
const {promisifyAll} = require('@google-cloud/promisify');
28+
const {paginator} = require('@google-cloud/paginator');
2829

2930
const Autoscaler = require('./autoscaler.js');
3031
const Disk = require('./disk.js');
@@ -889,9 +890,7 @@ Zone.prototype.getAutoscalers = function(options, callback) {
889890
* this.end();
890891
* });
891892
*/
892-
Zone.prototype.getAutoscalersStream = common.paginator.streamify(
893-
'getAutoscalers'
894-
);
893+
Zone.prototype.getAutoscalersStream = paginator.streamify('getAutoscalers');
895894

896895
/**
897896
* Get a list of disks in this zone.
@@ -1020,7 +1019,7 @@ Zone.prototype.getDisks = function(options, callback) {
10201019
* this.end();
10211020
* });
10221021
*/
1023-
Zone.prototype.getDisksStream = common.paginator.streamify('getDisks');
1022+
Zone.prototype.getDisksStream = paginator.streamify('getDisks');
10241023

10251024
/**
10261025
* Get a list of instance groups for this zone.
@@ -1151,7 +1150,7 @@ Zone.prototype.getInstanceGroups = function(options, callback) {
11511150
* this.end();
11521151
* });
11531152
*/
1154-
Zone.prototype.getInstanceGroupsStream = common.paginator.streamify(
1153+
Zone.prototype.getInstanceGroupsStream = paginator.streamify(
11551154
'getInstanceGroups'
11561155
);
11571156

@@ -1251,9 +1250,7 @@ Zone.prototype.getMachineTypes = function(options, callback) {
12511250
* this.end();
12521251
* });
12531252
*/
1254-
Zone.prototype.getMachineTypesStream = common.paginator.streamify(
1255-
'getMachineTypes'
1256-
);
1253+
Zone.prototype.getMachineTypesStream = paginator.streamify('getMachineTypes');
12571254

12581255
/**
12591256
* Get a list of operations for this zone.
@@ -1383,9 +1380,7 @@ Zone.prototype.getOperations = function(options, callback) {
13831380
* this.end();
13841381
* });
13851382
*/
1386-
Zone.prototype.getOperationsStream = common.paginator.streamify(
1387-
'getOperations'
1388-
);
1383+
Zone.prototype.getOperationsStream = paginator.streamify('getOperations');
13891384

13901385
/**
13911386
* Get a list of VM instances in this zone.
@@ -1512,7 +1507,7 @@ Zone.prototype.getVMs = function(options, callback) {
15121507
* this.end();
15131508
* });
15141509
*/
1515-
Zone.prototype.getVMsStream = common.paginator.streamify('getVMs');
1510+
Zone.prototype.getVMsStream = paginator.streamify('getVMs');
15161511

15171512
/**
15181513
* Get a reference to a Google Compute Engine instance group.
@@ -1647,7 +1642,7 @@ Zone.prototype.createHttpsServerFirewall_ = function(callback) {
16471642
*
16481643
* These methods can be auto-paginated.
16491644
*/
1650-
common.paginator.extend(Zone, [
1645+
paginator.extend(Zone, [
16511646
'getAutoscalers',
16521647
'getDisks',
16531648
'getInstanceGroups',

0 commit comments

Comments
 (0)