Skip to content

Commit

Permalink
feat: use teeny-request to reduce module size (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Oct 4, 2018
1 parent 34742bb commit ce38b21
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/google-cloud-compute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"extend": "^3.0.1",
"gce-images": "^0.3.3",
"is": "^3.2.1",
"string-format-obj": "^1.1.1"
"string-format-obj": "^1.1.1",
"teeny-request": "^3.10.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^2.3.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const common = require('@google-cloud/common');
const {promisifyAll} = require('@google-cloud/promisify');
const util = require('util');
const {teenyRequest} = require('teeny-request');

/**
* An Address object allows you to interact with a Google Compute Engine
Expand Down Expand Up @@ -166,6 +167,7 @@ function Address(region, name) {
id: name,
createMethod: region.createAddress.bind(region),
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/autoscaler.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const common = require('@google-cloud/common');
const {promisifyAll} = require('@google-cloud/promisify');
const util = require('util');
const {teenyRequest} = require('teeny-request');

/*! Developer Documentation
*
Expand Down Expand Up @@ -181,6 +182,7 @@ function Autoscaler(zone, name) {
id: name,
createMethod: zone.createAutoscaler.bind(zone),
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/google-cloud-compute/src/disk.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const format = require('string-format-obj');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

const {teenyRequest} = require('teeny-request');
const Snapshot = require('./snapshot.js');

/**
Expand Down Expand Up @@ -178,6 +178,7 @@ function Disk(zone, name) {
id: name,
createMethod: zone.createDisk.bind(zone),
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/firewall.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');

/**
* A Firewall object allows you to interact with a Google Compute Engine
Expand Down Expand Up @@ -169,6 +170,7 @@ function Firewall(compute, name) {
id: name,
createMethod: compute.createFirewall.bind(compute),
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/health-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const extend = require('extend');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');

/**
* Health checks ensure that Compute Engine forwards new connections only to
Expand Down Expand Up @@ -196,6 +197,7 @@ function HealthCheck(compute, name, options) {
compute.createHealthCheck(name, options, callback);
},
methods: methods,
requestModule: teenyRequest,
});
}

Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');

/**
* An Image object allows you to interact with a Google Compute Engine image.
Expand Down Expand Up @@ -160,6 +161,7 @@ function Image(compute, name) {
id: name,
createMethod: compute.createImage.bind(compute),
methods: methods,
requestModule: teenyRequest,
});
}

Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {paginator} = require('@google-cloud/paginator');
const {teenyRequest} = require('teeny-request');

const Firewall = require('./firewall.js');
const HealthCheck = require('./health-check.js');
Expand Down Expand Up @@ -87,6 +88,7 @@ function Compute(options) {
baseUrl: 'https://www.googleapis.com/compute/v1',
scopes: ['https://www.googleapis.com/auth/compute'],
packageJson: require('../package.json'),
requestModule: teenyRequest,
};

common.Service.call(this, config, options);
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/instance-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {paginator} = require('@google-cloud/paginator');
const {teenyRequest} = require('teeny-request');

/**
* You can create and manage groups of virtual machine instances so that you
Expand Down Expand Up @@ -177,6 +178,7 @@ function InstanceGroup(zone, name) {
id: name,
createMethod: zone.createInstanceGroup.bind(zone),
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/machine-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const common = require('@google-cloud/common');
const util = require('util');
const {teenyRequest} = require('teeny-request');

/**
* A MachineType object allows you to interact with a Google Compute Engine
Expand Down Expand Up @@ -131,6 +132,7 @@ function MachineType(zone, name) {
*/
id: name,
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const format = require('string-format-obj');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');

/**
* A Network object allows you to interact with a Google Compute Engine network.
Expand Down Expand Up @@ -172,6 +173,7 @@ function Network(compute, name) {
id: name,
createMethod: compute.createNetwork.bind(compute),
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');

/**
* An Operation object allows you to interact with a Google Compute Engine
Expand Down Expand Up @@ -178,6 +179,7 @@ function Operation(scope, name) {
*/
id: name,
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');

/**
* A Project object allows you to interact with your Google Compute Engine
Expand Down Expand Up @@ -103,6 +104,7 @@ function Project(compute) {
baseUrl: '',
id: '',
methods: methods,
requestModule: teenyRequest,
});
}

Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/region.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {paginator} = require('@google-cloud/paginator');
const {teenyRequest} = require('teeny-request');

const Address = require('./address.js');
const Network = require('./network.js');
Expand Down Expand Up @@ -135,6 +136,7 @@ function Region(compute, name) {
*/
id: name,
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');

/**
* Forwarding rules work in conjunction with target pools and target instances
Expand Down Expand Up @@ -191,6 +192,7 @@ function Rule(scope, name) {
id: name,
createMethod: scope.createRule.bind(scope),
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const format = require('string-format-obj');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');

/**
* An HTTP(S) load balancing backend service is a centralized service for
Expand Down Expand Up @@ -185,6 +186,7 @@ function Service(compute, name) {
id: name,
createMethod: compute.createService.bind(compute),
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');

/**
* A Snapshot object allows you to interact with a Google Compute Engine
Expand Down Expand Up @@ -138,6 +139,7 @@ function Snapshot(scope, name) {
*/
id: name,
methods: methods,
requestModule: teenyRequest,
};

if (isDisk) {
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/subnetwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');

/**
* An Subnetwork object allows you to interact with a Google Compute Engine
Expand Down Expand Up @@ -184,6 +185,7 @@ function Subnetwork(region, name) {
id: this.name,
createMethod: region.createSubnetwork.bind(region),
methods: methods,
requestModule: teenyRequest,
});
}

Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {replaceProjectIdToken} = require('@google-cloud/projectify');
const {teenyRequest} = require('teeny-request');

const Disk = require('./disk.js');

Expand Down Expand Up @@ -250,6 +251,7 @@ function VM(zone, name) {
id: this.name,
createMethod: zone.createVM.bind(zone),
methods: methods,
requestModule: teenyRequest,
});
}

Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-compute/src/zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');
const {paginator} = require('@google-cloud/paginator');
const {teenyRequest} = require('teeny-request');

const Autoscaler = require('./autoscaler.js');
const Disk = require('./disk.js');
Expand Down Expand Up @@ -140,6 +141,7 @@ function Zone(compute, name) {
*/
id: name,
methods: methods,
requestModule: teenyRequest,
});

/**
Expand Down

0 comments on commit ce38b21

Please sign in to comment.