@@ -65,12 +65,6 @@ var streamRouter = require('../common/stream-router.js');
6565 */
6666var util = require ( '../common/util.js' ) ;
6767
68- /**
69- * @type {module:compute/vm }
70- * @private
71- */
72- var VM = require ( './vm.js' ) ;
73-
7468/**
7569 * @type {module:compute/zone }
7670 * @private
@@ -173,7 +167,7 @@ Compute.prototype.createFirewall = function(name, config, callback) {
173167 throw new Error ( 'A firewall name must be provided.' ) ;
174168 }
175169
176- if ( ! is . obj ( config ) ) {
170+ if ( ! is . object ( config ) ) {
177171 throw new Error ( 'A firewall configuration object must be provided.' ) ;
178172 }
179173
@@ -248,90 +242,6 @@ Compute.prototype.createNetwork = function(name, config, callback) {
248242 } ) ;
249243} ;
250244
251- /**
252- * Create a virtual machine. This is a convenience method that wraps
253- * {module:compute/zone#createVM}. See that method for a full list of supported
254- * arguments.
255- *
256- * @param {string } name - Name of the instance.
257- * @param {object } config - See an
258- * [Instance resource](https://goo.gl/fuLRMj) for more information.
259- * @param {string|module:compute/zone } config.zone - The zone to create the VM
260- * in.
261- * @param {function } callback - The callback function.
262- *
263- * @example
264- * //-
265- * // Create a new instance using the latest Debian version as the source image
266- * // for a new boot disk.
267- * //-
268- * var config = {
269- * os: 'debian',
270- * http: true,
271- * zone: 'us-central1-a'
272- * };
273- *
274- * //-
275- * // The above object will auto-expand behind the scenes to something like the
276- * // following. The Debian version may be different when you run the command.
277- * //-
278- * var config = {
279- * machineType: 'n1-standard-1',
280- * disks: [
281- * {
282- * boot: true,
283- * initializeParams: {
284- * sourceImage:
285- * 'https://www.googleapis.com/compute/v1/projects' +
286- * '/debian-cloud/global/images/debian-7-wheezy-v20150710'
287- * }
288- * }
289- * ],
290- * networkInterfaces: [
291- * {
292- * network: 'global/networks/default'
293- * }
294- * ],
295- * tags: [
296- * {
297- * items: [
298- * 'http-server'
299- * ]
300- * }
301- * ],
302- * zone: 'us-central1-a'
303- * };
304- *
305- * function callback(err, instance, operation, apiResponse) {
306- * // `instance` is an Instance object.
307- *
308- * // `operation` is an Operation object that can be used to check the status
309- * // of the request.
310- * }
311- *
312- * gce.createVM('new-vm-name', config, callback);
313- */
314- Compute . prototype . createVM = function ( name , config , callback ) {
315- config = config || { } ;
316-
317- var zoneName = config . zone ;
318- delete config . zone ;
319-
320- if ( ! zoneName ) {
321- throw new Error ( 'A zone is required to create a virtual machine.' ) ;
322- }
323-
324- var zone ;
325-
326- if ( zoneName instanceof Zone ) {
327- zone = zoneName ;
328- } else {
329- zone = this . zone ( zoneName ) ;
330- }
331-
332- zone . createVM ( name , config , callback ) ;
333- } ;
334-
335245/**
336246 * Get a reference to a Google Compute Engine firewall.
337247 *
@@ -438,9 +348,7 @@ Compute.prototype.getAddresses = function(options, callback) {
438348 var regions = resp . items || { } ;
439349
440350 var addresses = Object . keys ( regions ) . reduce ( function ( acc , regionName ) {
441- regionName = regionName . replace ( 'regions/' , '' ) ;
442-
443- var region = self . region ( regionName ) ;
351+ var region = self . region ( regionName . replace ( 'regions/' , '' ) ) ;
444352 var regionAddresses = regions [ regionName ] . addresses || [ ] ;
445353
446354 regionAddresses . forEach ( function ( address ) {
@@ -543,9 +451,7 @@ Compute.prototype.getDisks = function(options, callback) {
543451 var zones = resp . items || { } ;
544452
545453 var disks = Object . keys ( zones ) . reduce ( function ( acc , zoneName ) {
546- zoneName = zoneName . replace ( 'zones/' , '' ) ;
547-
548- var zone = self . zone ( zoneName ) ;
454+ var zone = self . zone ( zoneName . replace ( 'zones/' , '' ) ) ;
549455 var disks = zones [ zoneName ] . disks || [ ] ;
550456
551457 disks . forEach ( function ( disk ) {
@@ -555,7 +461,7 @@ Compute.prototype.getDisks = function(options, callback) {
555461 } ) ;
556462
557463 return acc ;
558- } ) ;
464+ } , [ ] ) ;
559465
560466 callback ( null , disks , nextQuery , resp ) ;
561467 } ) ;
@@ -1096,19 +1002,6 @@ Compute.prototype.snapshot = function(name) {
10961002 return new Snapshot ( this , name ) ;
10971003} ;
10981004
1099- /**
1100- * Get a reference to a Google Compute Engine virtual machine instance.
1101- *
1102- * @param {string } name - Name of the existing virtual machine.
1103- * @return {module:compute/vm }
1104- *
1105- * @example
1106- * var vm = gce.vm('vm-name');
1107- */
1108- Compute . prototype . vm = function ( name ) {
1109- return new VM ( this , null , name ) ;
1110- } ;
1111-
11121005/**
11131006 * Get a reference to a Google Compute Engine zone.
11141007 *
0 commit comments