New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/compute

Package Overview
Dependencies
Maintainers
13
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/compute - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

LICENSE

97

package.json
{
"name": "@google-cloud/compute",
"version": "0.8.0",
"description": "Google Compute Engine Client Library for Node.js",
"version": "0.9.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"description": "Google Compute Engine Client Library for Node.js",
"contributors": [
{
"name": "Burcu Dogan",
"email": "jbd@google.com"
},
{
"name": "Johan Euphrosine",
"email": "proppy@google.com"
},
{
"name": "Patrick Costello",
"email": "pcostell@google.com"
},
{
"name": "Ryan Seys",
"email": "ryan@ryanseys.com"
},
{
"name": "Silvano Luciani",
"email": "silvano@google.com"
},
{
"name": "Stephen Sawchuk",
"email": "sawchuk@gmail.com"
}
],
"engines": {
"node": ">=4.0.0"
},
"repository": "googleapis/nodejs-compute",
"main": "./src/index.js",

@@ -37,5 +16,4 @@ "files": [

"CONTRIBUTORS",
"COPYING"
"LICENSE"
],
"repository": "googlecloudplatform/google-cloud-node",
"keywords": [

@@ -53,8 +31,38 @@ "google apis client",

],
"contributors": [
"Ace Nassri <anassri@google.com>",
"Akash Krishnan <akashfoss@users.noreply.github.com>",
"Ashley <ashley.schuett@containership.io>",
"Ashley Schuett <ashley@containership.io>",
"CRoed <chris.roed@anserinnovation.com>",
"Dave Gramlich <callmehiphop@gmail.com>",
"Eric Uldall <ericuldall@gmail.com>",
"Jason Dobry <jason.dobry@gmail.com>",
"Jason Dobry <jmdobry@users.noreply.github.com>",
"Kevin Leung <kevinresol@users.noreply.github.com>",
"Luke Sneeringer <luke@sneeringer.com>",
"Luke Sneeringer <lukesneeringer@google.com>",
"NickZ <NZatkovich@gmail.com>",
"Stephen Sawchuk <sawchuk@gmail.com>",
"Stephen Sawchuk <stephenplusplus@users.noreply.github.com>",
"Tim Swast <swast@google.com>",
"greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>"
],
"scripts": {
"cover": "nyc --reporter=lcov mocha --require intelli-espower-loader test/*.js && nyc report",
"docs": "repo-tools exec -- jsdoc -c .jsdoc.js",
"generate-scaffolding": "repo-tools generate all && repo-tools generate lib_samples_readme -l samples/ --config ../.cloud-repo-tools.json",
"lint": "repo-tools lint --cmd eslint -- src/ samples/ system-test/ test/",
"prettier": "repo-tools exec -- prettier --write src/*.js src/*/*.js samples/*.js samples/*/*.js test/*.js test/*/*.js system-test/*.js system-test/*/*.js",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"system-test": "repo-tools test run --cmd mocha -- system-test/*.js --no-timeouts",
"test-no-cover": "repo-tools test run --cmd mocha -- test/*.js --no-timeouts",
"test": "repo-tools test run --cmd npm -- run cover"
},
"dependencies": {
"@google-cloud/common": "^0.13.0",
"arrify": "^1.0.0",
"async": "^2.0.1",
"async": "^2.5.0",
"create-error-class": "^3.0.2",
"extend": "^3.0.0",
"extend": "^3.0.1",
"gce-images": "^0.3.0",

@@ -65,17 +73,22 @@ "is": "^3.0.1",

"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^2.1.0",
"async": "^2.5.0",
"codecov": "^3.0.0",
"concat-stream": "^1.5.0",
"mocha": "^3.0.1",
"eslint": "^4.9.0",
"eslint-config-prettier": "^2.6.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-prettier": "^2.3.1",
"extend": "^3.0.1",
"ink-docstrap": "^1.3.0",
"intelli-espower-loader": "^1.0.1",
"jsdoc": "^3.5.5",
"mocha": "^4.0.1",
"nyc": "^11.2.1",
"power-assert": "^1.4.4",
"prettier": "^1.7.4",
"propprop": "^0.3.0",
"proxyquire": "^1.7.10",
"uuid": "^3.0.1"
},
"scripts": {
"publish-module": "node ../../scripts/publish.js compute",
"test": "mocha test/*.js",
"system-test": "mocha system-test/*.js --no-timeouts --bail"
},
"license": "Apache-2.0",
"engines": {
"node": ">=4.0.0"
}
}

@@ -1,100 +0,127 @@

# @google-cloud/compute ([Alpha][versioning])
> Google Compute Engine Client Library for Node.js
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
*Looking for more Google APIs than just Compute Engine? You might want to check out [`google-cloud`][google-cloud].*
# [Google Compute Engine: Node.js Client](https://github.com/googleapis/nodejs-compute)
- [API Documentation][gcloud-compute-docs]
- [Official Documentation][cloud-compute-docs]
[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style&#x3D;flat)](https://cloud.google.com/terms/launch-stages)
[![CircleCI](https://img.shields.io/circleci/project/github/googleapis/nodejs-compute.svg?style=flat)](https://circleci.com/gh/googleapis/nodejs-compute)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/github/googleapis/nodejs-compute?branch=master&svg=true)](https://ci.appveyor.com/project/googleapis/nodejs-compute)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-compute/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-compute)
> Node.js idiomatic client for [Compute Engine][product-docs].
```sh
$ npm install --save @google-cloud/compute
```
```js
var gce = require('@google-cloud/compute')({
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
});
[Compute Engine](https://cloud.google.com/compute/docs/) lets you create and run virtual machines on Google infrastructure. Compute Engine offers scale, performance, and value that allows you to easily launch large compute clusters on Google&#x27;s infrastructure. There are no upfront investments and you can run thousands of virtual CPUs on a system that has been designed to be fast, and to offer strong consistency of performance.
// Create a new VM using the latest OS image of your choice.
var zone = gce.zone('us-central1-a');
var name = 'ubuntu-http';
zone.createVM(name, { os: 'ubuntu' }, function(err, vm, operation) {
// `operation` lets you check the status of long-running tasks.
* [Compute Engine Node.js Client API Reference][client-docs]
* [github.com/googleapis/nodejs-compute](https://github.com/googleapis/nodejs-compute)
* [Compute Engine Documentation][product-docs]
operation
.on('error', function(err) {})
.on('running', function(metadata) {})
.on('complete', function() {
// Virtual machine created!
});
});
Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in [Client Libraries Explained][explained].
// Promises are also supported by omitting callbacks.
zone.createVM(name)
.then(function(data) {
var vm = data[0];
var operation = data[1];
[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
**Table of contents:**
* [Quickstart](#quickstart)
* [Before you begin](#before-you-begin)
* [Installing the client library](#installing-the-client-library)
* [Using the client library](#using-the-client-library)
* [Samples](#samples)
* [Versioning](#versioning)
* [Contributing](#contributing)
* [License](#license)
## Quickstart
### Before you begin
1. Select or create a Cloud Platform project.
[Go to the projects page][projects]
1. Enable billing for your project.
[Enable billing][billing]
1. Enable the Google Compute Engine API.
[Enable the API][enable_api]
1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation.
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=compute.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started
### Installing the client library
npm install --save @google-cloud/compute
### Using the client library
```javascript
// Imports the Google Cloud client library
const Compute = require('@google-cloud/compute');
// Creates a client
const compute = new Compute();
// Create a new VM using the latest OS image of your choice.
const zone = compute.zone('us-central1-a');
const name = 'ubuntu-http';
zone
.createVM(name, {os: 'ubuntu'}, data => {
// `operation` lets you check the status of long-running tasks.
const vm = data[0];
const operation = data[1];
return operation.promise();
})
.then(function() {
.then(() => {
// Virtual machine created!
});
// It's also possible to integrate with third-party Promise libraries.
var gce = require('@google-cloud/compute')({
promise: require('bluebird')
});
})
.catch(err => {
console.error('ERROR:', err);
});;
```
## Samples
## Authentication
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-compute/tree/master/samples) directory. The samples' `README.md`
has instructions for running the samples.
It's incredibly easy to get authenticated and start using Google's APIs. You can set your credentials on a global basis as well as on a per-API basis. See each individual API section below to see how you can auth on a per-API-basis. This is useful if you want to use different accounts for different Cloud services.
| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Virtual Machines | [source code](https://github.com/googleapis/nodejs-compute/blob/master/samples/vms.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-compute&page=editor&open_in_editor=samples/vms.js,samples/README.md) |
### On Google Cloud Platform
The [Compute Engine Node.js Client API Reference][client-docs] documentation
also contains samples.
If you are running this client on Google Cloud Platform, we handle authentication for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access.
## Versioning
``` js
var gce = require('@google-cloud/compute')();
// ...you're good to go!
```
This library follows [Semantic Versioning](http://semver.org/).
### Elsewhere
This library is considered to be in **alpha**. This means it is still a
work-in-progress and under active development. Any release is subject to
backwards-incompatible changes at any time.
If you are not running this client on Google Cloud Platform, you need a Google Developers service account. To create a service account:
More Information: [Google Cloud Platform Launch Stages][launch_stages]
1. Visit the [Google Developers Console][dev-console].
2. Create a new project or click on an existing project.
3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services):
* Google Compute Engine API
4. Navigate to **APIs & auth** > **Credentials** and then:
* If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests.
* If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file.
[launch_stages]: https://cloud.google.com/terms/launch-stages
``` js
var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123'
## Contributing
var gce = require('@google-cloud/compute')({
projectId: projectId,
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-compute/blob/master/.github/CONTRIBUTING.md).
// The path to your key file:
keyFilename: '/path/to/keyfile.json'
## License
// Or the contents of the key file:
credentials: require('./path/to/keyfile.json')
});
Apache Version 2.0
// ...you're good to go!
```
See [LICENSE](https://github.com/googleapis/nodejs-compute/blob/master/LICENSE)
[versioning]: https://github.com/GoogleCloudPlatform/google-cloud-node#versioning
[google-cloud]: https://github.com/GoogleCloudPlatform/google-cloud-node
[gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
[dev-console]: https://console.developers.google.com/project
[gcloud-compute-docs]: https://googlecloudplatform.github.io/google-cloud-node/#/docs/compute
[cloud-compute-docs]: https://cloud.google.com/compute/docs
[client-docs]: https://cloud.google.com/nodejs/docs/reference/compute/latest/
[product-docs]: https://cloud.google.com/compute/docs/
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/address
*/
'use strict';

@@ -27,7 +23,2 @@

/*! Developer Documentation
*
* @param {module:region} region - Region this address belongs to.
* @param {string} name - The name of the address.
*/
/**

@@ -37,12 +28,14 @@ * An Address object allows you to interact with a Google Compute Engine

*
* @resource [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @resource [Address Resource]{@link https://cloud.google.com/compute/docs/reference/v1/addresses} *
* @see [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @see [Address Resource]{@link https://cloud.google.com/compute/docs/reference/v1/addresses} *
*
* @constructor
* @alias module:compute/address
* @class
* @param {Region} region
* @param {string} name
*
* @example
* var region = gce.region('region-name');
*
* var address = region.address('address1');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const address = region.address('address1');
*/

@@ -54,5 +47,11 @@ function Address(region, name) {

*
* @param {object=} options - See {module:compute#createAddress}.
* @method Address#create
* @param {object=} options - See {Region#createAddress}.
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const address = region.address('address1');
*
* address.create(function(err, address, operation, apiResponse) {

@@ -69,5 +68,5 @@ * // `address` is an Address object.

* address.create().then(function(data) {
* var address = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const address = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -80,2 +79,3 @@ */

*
* @method Address#exists
* @param {function} callback - The callback function.

@@ -87,2 +87,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const address = region.address('address1');
*
* address.exists(function(err, exists) {});

@@ -94,3 +99,3 @@ *

* address.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -108,2 +113,3 @@ */

*
* @method Address#get
* @param {options=} options - Configuration object.

@@ -114,2 +120,7 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const address = region.address('address1');
*
* address.get(function(err, address, apiResponse) {

@@ -123,4 +134,4 @@ * // `address` is an Address object.

* address.get().then(function(data) {
* var address = data[0];
* var apiResponse = data[1];
* const address = data[0];
* const apiResponse = data[1];
* });

@@ -133,5 +144,6 @@ */

*
* @resource [Address Resource]{@link https://cloud.google.com/compute/docs/reference/v1/addresses}
* @resource [Addresses: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/addresses/get}
* @see [Address Resource]{@link https://cloud.google.com/compute/docs/reference/v1/addresses}
* @see [Addresses: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/addresses/get}
*
* @method Address#getMetadata
* @param {function=} callback - The callback function.

@@ -144,2 +156,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const address = region.address('address1');
*
* address.getMetadata(function(err, metadata, apiResponse) {});

@@ -151,7 +168,7 @@ *

* address.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -164,6 +181,16 @@

createMethod: region.createAddress.bind(region),
methods: methods
methods: methods,
});
/**
* @name Address#name
* @type {string}
*/
this.name = name;
/**
* The parent {@link Region} instance of this {@link Address} instance.
* @name Address#region
* @type {Region}
*/
this.region = region;

@@ -177,7 +204,7 @@ }

*
* @resource [Addresses: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/addresses/delete}
* @see [Addresses: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/addresses/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -187,2 +214,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const address = region.address('address1');
*
* address.delete(function(err, operation, apiResponse) {

@@ -197,4 +229,4 @@ * // `operation` is an Operation object that can be used to check the status

* address.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -207,16 +239,19 @@ */

this.request({
method: 'DELETE',
uri: ''
}, function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
this.request(
{
method: 'DELETE',
uri: '',
},
function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
var operation = region.operation(resp.name);
operation.metadata = resp;
var operation = region.operation(resp.name);
operation.metadata = resp;
callback(null, operation, resp);
});
callback(null, operation, resp);
}
);
};

@@ -223,0 +258,0 @@

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/autoscaler
*/
'use strict';

@@ -29,3 +25,3 @@

*
* @param {module:compute/zone} zone - Zone object this autoscaler belongs to.
* @param {Zone} zone - Zone object this autoscaler belongs to.
* @param {string} name - Name of the autoscaler.

@@ -37,11 +33,13 @@ */

*
* @resource [Autoscaling Groups of Instances]{@link https://cloud.google.com/compute/docs/autoscaler}
* @see [Autoscaling Groups of Instances]{@link https://cloud.google.com/compute/docs/autoscaler}
*
* @constructor
* @alias module:compute/autoscaler
* @class
* @param {Zone} zone
* @param {string} name
*
* @example
* var zone = gce.zone('us-central1-a');
*
* var autoscaler = zone.autoscaler('autoscaler-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const autoscaler = zone.autoscaler('autoscaler-name');
*/

@@ -53,6 +51,12 @@ function Autoscaler(zone, name) {

*
* @param {object} config - See {module:compute/zone#createAutoscaler}.
* @method Autoscaler#create
* @param {object} config - See {Zone#createAutoscaler}.
*
* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const autoscaler = zone.autoscaler('autoscaler-name');
*
* const config = {
* coolDown: 30,

@@ -66,3 +70,3 @@ * cpu: 80,

*
* var callback = function(err, autoscaler, operation, apiResponse) {
* const callback = function(err, autoscaler, operation, apiResponse) {
* // `autoscaler` is an Autoscaler object.

@@ -80,5 +84,5 @@ *

* autoscaler.create(config).then(function(data) {
* var autoscaler = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const autoscaler = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -91,2 +95,3 @@ */

*
* @method Autoscaler#exists
* @param {function} callback - The callback function.

@@ -98,2 +103,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const autoscaler = zone.autoscaler('autoscaler-name');
*
* autoscaler.exists(function(err, exists) {});

@@ -105,3 +115,3 @@ *

* autoscaler.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -119,2 +129,3 @@ */

*
* @method Autoscaler#get
* @param {options=} options - Configuration object.

@@ -125,2 +136,7 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const autoscaler = zone.autoscaler('autoscaler-name');
*
* autoscaler.get(function(err, autoscaler, apiResponse) {

@@ -134,4 +150,4 @@ * // `autoscaler` is an Autoscaler object.

* autoscaler.get().then(function(data) {
* var autoscaler = data[0];
* var apiResponse = data[1];
* const autoscaler = data[0];
* const apiResponse = data[1];
* });

@@ -144,4 +160,5 @@ */

*
* @resource [Autoscaler Resource]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers}
* @resource [Autoscalers: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers/get}
* @method Autoscaler#getMetadata
* @see [Autoscaler Resource]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers}
* @see [Autoscalers: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers/get}
*

@@ -155,2 +172,7 @@ * @param {function=} callback - The callback function.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const autoscaler = zone.autoscaler('autoscaler-name');
*
* autoscaler.getMetadata(function(err, metadata, apiResponse) {});

@@ -162,7 +184,7 @@ *

* autoscaler.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -175,6 +197,16 @@

createMethod: zone.createAutoscaler.bind(zone),
methods: methods
methods: methods,
});
/**
* @name Autoscaler#name
* @type {string}
*/
this.name = name;
/**
* Parent {@link Zone} instance of this {@link Autoscaler} instance.
* @name Autoscaler#zone
* @type {Zone}
*/
this.zone = zone;

@@ -188,7 +220,7 @@ }

*
* @resource [Autoscalers: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers/delete}
* @see [Autoscalers: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -198,2 +230,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const autoscaler = zone.autoscaler('autoscaler-name');
*
* autoscaler.delete(function(err, operation, apiResponse) {

@@ -208,4 +245,4 @@ * // `operation` is an Operation object that can be used to check the status

* autoscaler.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -234,3 +271,3 @@ */

*
* @resource [Autoscaler Resource]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers}
* @see [Autoscaler Resource]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers}
*

@@ -241,3 +278,3 @@ * @param {object} metadata - See a

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -247,3 +284,8 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var metadata = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const autoscaler = zone.autoscaler('autoscaler-name');
*
* const metadata = {
* description: 'New description'

@@ -261,4 +303,4 @@ * };

* autoscaler.setMetadata(metadata).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -275,20 +317,23 @@ */

zone.request({
method: 'PATCH',
uri: '/autoscalers',
qs: {
autoscaler: this.name
zone.request(
{
method: 'PATCH',
uri: '/autoscalers',
qs: {
autoscaler: this.name,
},
json: metadata,
},
json: metadata
}, function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
var operation = zone.operation(resp.name);
operation.metadata = resp;
var operation = zone.operation(resp.name);
operation.metadata = resp;
callback(null, operation, resp);
});
callback(null, operation, resp);
}
);
};

@@ -295,0 +340,0 @@

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/disk
*/
'use strict';

@@ -30,26 +26,19 @@

/**
* @type {module:compute/snapshot}
* @private
*/
var Snapshot = require('./snapshot.js');
/*! Developer Documentation
*
* @param {module:zone} zone - Zone this disk belongs to.
* @param {string} name - The name of the disk.
*/
/**
* A Disk object allows you to interact with a Google Compute Engine disk.
*
* @resource [Disks Overview]{@link https://cloud.google.com/compute/docs/disks}
* @resource [Disk Resource]{@link https://cloud.google.com/compute/docs/reference/v1/disks}
* @see [Disks Overview]{@link https://cloud.google.com/compute/docs/disks}
* @see [Disk Resource]{@link https://cloud.google.com/compute/docs/reference/v1/disks}
*
* @constructor
* @alias module:compute/disk
* @class
* @param {Zone} zone
* @param {string} name
*
* @example
* var zone = gce.zone('zone-name');
*
* var disk = zone.disk('disk1');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const disk = zone.disk('disk1');
*/

@@ -61,6 +50,12 @@ function Disk(zone, name) {

*
* @param {object} config - See {module:compute/zone#createDisk}.
* @method Disk#create
* @param {object} config - See {Zone#createDisk}.
*
* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const disk = zone.disk('disk1');
*
* const config = {
* // ...

@@ -80,5 +75,5 @@ * };

* disk.create(config).then(function(data) {
* var disk = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const disk = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -91,2 +86,3 @@ */

*
* @method Disk#exists
* @param {function} callback - The callback function.

@@ -98,2 +94,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const disk = zone.disk('disk1');
*
* disk.exists(function(err, exists) {});

@@ -105,3 +106,3 @@ *

* disk.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -119,2 +120,3 @@ */

*
* @method Disk#get
* @param {options=} options - Configuration object.

@@ -125,2 +127,7 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const disk = zone.disk('disk1');
*
* disk.get(function(err, disk, apiResponse) {

@@ -134,4 +141,4 @@ * // `disk` is a Disk object.

* disk.get().then(function(data) {
* var disk = data[0];
* var apiResponse = data[1];
* const disk = data[0];
* const apiResponse = data[1];
* });

@@ -144,4 +151,5 @@ */

*
* @resource [Disk Resource]{@link https://cloud.google.com/compute/docs/reference/v1/disks}
* @resource [Disks: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/disks/get}
* @method Disk#getMetadata
* @see [Disk Resource]{@link https://cloud.google.com/compute/docs/reference/v1/disks}
* @see [Disks: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/disks/get}
*

@@ -155,2 +163,7 @@ * @param {function=} callback - The callback function.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const disk = zone.disk('disk1');
*
* disk.getMetadata(function(err, metadata, apiResponse) {});

@@ -162,7 +175,7 @@ *

* disk.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -173,10 +186,28 @@

baseUrl: '/disks',
/**
* @name Disk#id
* @type {string}
*/
id: name,
createMethod: zone.createDisk.bind(zone),
methods: methods
methods: methods,
});
/**
* @name Disk#name
* @type {string}
*/
this.name = name;
/**
* The parent {@link Zone} instance of this {@link Disk} instance.
* @name Disk#zone
* @type {Zone}
*/
this.zone = zone;
/**
* @name Disk#formattedName
* @type {string}
*/
this.formattedName = Disk.formatName_(zone, name);

@@ -192,5 +223,5 @@ }

*
* @param {module:compute/zone} zone - The Zone this disk belongs to.
* @param {Zone} zone - The Zone this disk belongs to.
* @param {string} name - The name of the disk.
* @return {string} - The formatted name.
* @returns {string} - The formatted name.
*/

@@ -201,3 +232,3 @@ Disk.formatName_ = function(zone, name) {

zoneName: zone.name,
diskName: name
diskName: name,
});

@@ -209,4 +240,4 @@ };

*
* @resource [Snapshots Overview]{@link https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots}
* @resource [Disks: createSnapshot API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/disks/createSnapshot}
* @see [Snapshots Overview]{@link https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots}
* @see [Disks: createSnapshot API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/disks/createSnapshot}
*

@@ -219,5 +250,5 @@ * @param {string} name - Name of the snapshot.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/snapshot} callback.snapshot - The created Snapshot
* @param {Snapshot} callback.snapshot - The created Snapshot
* object.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -227,2 +258,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const disk = zone.disk('disk1');
*
* function callback(err, snapshot, operation, apiResponse) {

@@ -241,5 +277,5 @@ * // `snapshot` is a Snapshot object.

* disk.createSnapshot('new-snapshot-name').then(function(data) {
* var snapshot = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const snapshot = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -256,21 +292,24 @@ */

this.request({
method: 'POST',
uri: '/createSnapshot',
json: extend({}, options, {
name: name
})
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/createSnapshot',
json: extend({}, options, {
name: name,
}),
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var snapshot = self.snapshot(name);
var snapshot = self.snapshot(name);
var operation = zone.operation(resp.name);
operation.metadata = resp;
var operation = zone.operation(resp.name);
operation.metadata = resp;
callback(null, snapshot, operation, resp);
});
callback(null, snapshot, operation, resp);
}
);
};

@@ -281,7 +320,7 @@

*
* @resource [Disks: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/disks/delete}
* @see [Disks: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/disks/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -291,2 +330,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const disk = zone.disk('disk1');
*
* disk.delete(function(err, operation, apiResponse) {

@@ -301,4 +345,4 @@ * // `operation` is an Operation object that can be used to check the status

* disk.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -327,9 +371,13 @@ */

*
* @resource [Snapshots Overview]{@link https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots}
* @see [Snapshots Overview]{@link https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots}
*
* @param {string} name - Name of the snapshot.
* @return {module:compute/snapshot}
* @returns {Snapshot}
*
* @example
* var snapshot = disk.snapshot('snapshot-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const disk = zone.disk('disk1');
* const snapshot = disk.snapshot('snapshot-name');
*/

@@ -346,5 +394,5 @@ Disk.prototype.snapshot = function(name) {

common.util.promisifyAll(Disk, {
exclude: ['snapshot']
exclude: ['snapshot'],
});
module.exports = Disk;

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/firewall
*/
'use strict';

@@ -27,7 +23,2 @@

/*! Developer Documentation
*
* @param {module:compute} compute - Compute object this firewall belongs to.
* @param {string} name - Name of the firewall.
*/
/**

@@ -37,10 +28,13 @@ * A Firewall object allows you to interact with a Google Compute Engine

*
* @resource [Firewalls Overview]{@link https://cloud.google.com/compute/docs/networking#firewalls}
* @resource [Firewall Resource]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls}
* @see [Firewalls Overview]{@link https://cloud.google.com/compute/docs/networking#firewalls}
* @see [Firewall Resource]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls}
*
* @constructor
* @alias module:compute/firewall
* @class
* @param {Compute} compute
* @param {string} name
*
* @example
* var firewall = gce.firewall('tcp-3000');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const firewall = compute.firewall('tcp-3000');
*/

@@ -52,6 +46,11 @@ function Firewall(compute, name) {

*
* @param {object} config - See {module:compute#createFirewall}.
* @method Firewall#create
* @param {object} config - See {@link Compute#createFirewall}.
*
* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const firewall = compute.firewall('tcp-3000');
*
* const config = {
* // ...

@@ -71,5 +70,5 @@ * };

* firewall.create(config).then(function(data) {
* var firewall = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const firewall = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -82,2 +81,3 @@ */

*
* @method Firewall#exists
* @param {function} callback - The callback function.

@@ -89,2 +89,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const firewall = compute.firewall('tcp-3000');
*
* firewall.exists(function(err, exists) {});

@@ -96,3 +100,3 @@ *

* firewall.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -110,2 +114,3 @@ */

*
* @method Firewall#get
* @param {options=} options - Configuration object.

@@ -116,2 +121,6 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const firewall = compute.firewall('tcp-3000');
*
* firewall.get(function(err, firewall, apiResponse) {

@@ -125,4 +134,4 @@ * // `firewall` is a Firewall object.

* firewall.get().then(function(data) {
* var firewall = data[0];
* var apiResponse = data[1];
* const firewall = data[0];
* const apiResponse = data[1];
* });

@@ -135,5 +144,6 @@ */

*
* @resource [Firewalls: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls/get}
* @resource [Firewall Resource]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls}
* @see [Firewalls: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls/get}
* @see [Firewall Resource]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls}
*
* @method Firewall#getMetadata
* @param {function=} callback - The callback function.

@@ -146,2 +156,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const firewall = compute.firewall('tcp-3000');
*
* firewall.getMetadata(function(err, metadata, apiResponse) {});

@@ -153,7 +167,7 @@ *

* firewall.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -164,9 +178,28 @@

baseUrl: '/global/firewalls',
/**
* @name Firewall#id
* @type {string}
*/
id: name,
createMethod: compute.createFirewall.bind(compute),
methods: methods
methods: methods,
});
/**
* The parent {@link Compute} instance of this {@link Firewall} instance.
* @name Firewall#compute
* @type {Compute}
*/
this.compute = compute;
/**
* @name Firewall#name
* @type {string}
*/
this.name = name;
/**
* @name Firewall#metadata
* @type {object}
*/
this.metadata.network = 'global/networks/default';

@@ -180,7 +213,7 @@ }

*
* @resource [Firewalls: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls/delete}
* @see [Firewalls: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -190,2 +223,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const firewall = compute.firewall('tcp-3000');
*
* firewall.delete(function(err, operation, apiResponse) {

@@ -200,4 +237,4 @@ * // `operation` is an Operation object that can be used to check the status

* firewall.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -226,3 +263,3 @@ */

*
* @resource [Firewall Resource]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls}
* @see [Firewall Resource]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls}
*

@@ -233,3 +270,3 @@ * @param {object} metadata - See a

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -239,3 +276,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var metadata = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const firewall = compute.firewall('tcp-3000');
*
* const metadata = {
* description: 'New description'

@@ -253,4 +294,4 @@ * };

* firewall.setMetadata(metadata).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -267,17 +308,20 @@ */

this.request({
method: 'PATCH',
uri: '',
json: metadata
}, function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
this.request(
{
method: 'PATCH',
uri: '',
json: metadata,
},
function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
var operation = compute.operation(resp.name);
operation.metadata = resp;
var operation = compute.operation(resp.name);
operation.metadata = resp;
callback(null, operation, resp);
});
callback(null, operation, resp);
}
);
};

@@ -292,2 +336,7 @@

/**
* Reference to the {@link Firewall} class.
* @name module:@google-cloud/compute.Firewall
* @see Firewall
*/
module.exports = Firewall;

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/health-check
*/
'use strict';

@@ -29,11 +25,2 @@

/*! Developer Documentation
*
* @param {module:compute} compute - Compute object this health check belongs
* to.
* @param {string} name - Name of the health check.
* @param {object=} options - Optional configuration.
* @param {boolean} options.https - Specify if this is an HTTPS health check
* resource. Default: `false`
*/
/**

@@ -46,9 +33,16 @@ * Health checks ensure that Compute Engine forwards new connections only to

*
* @resource [Health Checks Overview]{@link https://cloud.google.com/compute/docs/load-balancing/health-checks}
* @see [Health Checks Overview]{@link https://cloud.google.com/compute/docs/load-balancing/health-checks}
*
* @constructor
* @alias module:compute/health-check
* @class
* @param {Compute} compute - Compute object this health check belongs
* to.
* @param {string} name - Name of the health check.
* @param {object=} options - Optional configuration.
* @param {boolean} options.https - Specify if this is an HTTPS health check
* resource. Default: `false`
*
* @example
* var healthCheck = gce.healthCheck('health-check-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const healthCheck = gce.healthCheck('health-check-name');
*/

@@ -60,5 +54,10 @@ function HealthCheck(compute, name, options) {

*
* @param {object} options - See {module:compute#createHealthCheck}.
* @method HealthCheck#create
* @param {object} options - See {@link Compute#createHealthCheck}.
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const healthCheck = gce.healthCheck('health-check-name');
*
* healthCheck.create(function(err, healthCheck, operation, apiResponse) {

@@ -75,5 +74,5 @@ * // `healthCheck` is a HealthCheck object.

* healthCheck.create().then(function(data) {
* var healthCheck = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const healthCheck = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -86,2 +85,3 @@ */

*
* @method HealthCheck#exists
* @param {function} callback - The callback function.

@@ -94,2 +94,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const healthCheck = gce.healthCheck('health-check-name');
*
* healthCheck.exists(function(err, exists) {});

@@ -101,3 +105,3 @@ *

* healthCheck.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -115,2 +119,3 @@ */

*
* @method HealthCheck#get
* @param {options=} options - Configuration object.

@@ -121,2 +126,6 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const healthCheck = gce.healthCheck('health-check-name');
*
* healthCheck.get(function(err, healthCheck, apiResponse) {

@@ -130,4 +139,4 @@ * // `healthCheck` is a HealthCheck object.

* healthCheck.get().then(function(data) {
* var healthCheck = data[0];
* var apiResponse = data[1];
* const healthCheck = data[0];
* const apiResponse = data[1];
* });

@@ -140,7 +149,8 @@ */

*
* @resource [HttpHealthChecks: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/get}
* @resource [HttpHealthCheck resource](https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks#resource)
* @resource [HttpsHealthChecks: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/get}
* @resource [HttpsHealthCheck resource](https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks#resource)
* @see [HttpHealthChecks: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/get}
* @see [HttpHealthCheck resource](https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks#resource)
* @see [HttpsHealthChecks: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/get}
* @see [HttpsHealthCheck resource](https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks#resource)
*
* @method HealthCheck#getMetadata
* @param {function=} callback - The callback function.

@@ -153,2 +163,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const healthCheck = gce.healthCheck('health-check-name');
*
* healthCheck.getMetadata(function(err, metadata, apiResponse) {});

@@ -160,7 +174,7 @@ *

* healthCheck.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -171,2 +185,8 @@

var https = options.https;
/**
* The parent {@link Compute} instance of this {@link HealthCheck} instance.
* @name HealthCheck#compute
* @type {Compute}
*/
this.compute = compute;

@@ -177,2 +197,6 @@

baseUrl: '/global/' + (https ? 'httpsHealthChecks' : 'httpHealthChecks'),
/**
* @name HealthCheck#id
* @type {string}
*/
id: name,

@@ -185,7 +209,7 @@ createMethod: function(name, options, callback) {

options = extend({}, options, { https: https });
options = extend({}, options, {https: https});
compute.createHealthCheck(name, options, callback);
},
methods: methods
methods: methods,
});

@@ -199,8 +223,8 @@ }

*
* @resource [HttpHealthCheck: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/delete}
* @resource [HttpsHealthCheck: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/delete}
* @see [HttpHealthCheck: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/delete}
* @see [HttpsHealthCheck: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -210,2 +234,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const healthCheck = gce.healthCheck('health-check-name');
*
* healthCheck.delete(function(err, operation, apiResponse) {

@@ -220,4 +248,4 @@ * // `operation` is an Operation object that can be used to check the status

* healthCheck.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -246,4 +274,4 @@ */

*
* @resource [HttpHealthCheck: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/insert}
* @resource [HttpsHealthCheck: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/insert}
* @see [HttpHealthCheck: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/insert}
* @see [HttpsHealthCheck: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/insert}
*

@@ -255,3 +283,3 @@ * @param {object} metadata - See a

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -261,3 +289,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var metadata = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const healthCheck = gce.healthCheck('health-check-name');
*
* const metadata = {
* description: 'New description'

@@ -275,4 +307,4 @@ * };

* healthCheck.setMetadata(metadata).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -307,2 +339,7 @@ */

/**
* Reference to the {@link HealthCheck} class.
* @name module:@google-cloud/compute.HealthCheck
* @see HealthCheck
*/
module.exports = HealthCheck;

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/instance-group
*/
'use strict';

@@ -30,8 +26,2 @@

/*! Developer Documentation
*
* @param {module:compute/zone} zone - Zone object this instance group belongs
* to.
* @param {string} name - Name of the instance group.
*/
/**

@@ -41,12 +31,14 @@ * You can create and manage groups of virtual machine instances so that you

*
* @resource [Creating Groups of Instances]{@link https://cloud.google.com/compute/docs/instance-groups}
* @resource [Unmanaged Instance Groups]{@link https://cloud.google.com/compute/docs/instance-groups/unmanaged-groups}
* @see [Creating Groups of Instances]{@link https://cloud.google.com/compute/docs/instance-groups}
* @see [Unmanaged Instance Groups]{@link https://cloud.google.com/compute/docs/instance-groups/unmanaged-groups}
*
* @constructor
* @alias module:compute/instance-group
* @class
* @param {Zone} zone
* @param {string} name
*
* @example
* var zone = gce.zone('us-central1-a');
*
* var instanceGroup = zone.instanceGroup('web-servers');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*/

@@ -58,5 +50,11 @@ function InstanceGroup(zone, name) {

*
* @param {object=} options - See {module:zone#createInstanceGroup}.
* @method InstanceGroup#create
* @param {object=} options - See {@link Zone#createInstanceGroup}.
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*
* function onCreated(err, instanceGroup, operation, apiResponse) {

@@ -75,5 +73,5 @@ * // `instanceGroup` is an InstanceGroup object.

* instanceGroup.create().then(function(data) {
* var instanceGroup = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const instanceGroup = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -86,2 +84,3 @@ */

*
* @method InstanceGroup#exists
* @param {function} callback - The callback function.

@@ -94,2 +93,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*
* instanceGroup.exists(function(err, exists) {});

@@ -101,3 +105,3 @@ *

* instanceGroup.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -115,2 +119,3 @@ */

*
* @method InstanceGroup#get
* @param {options=} options - Configuration object.

@@ -121,2 +126,7 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*
* instanceGroup.get(function(err, instanceGroup, apiResponse) {

@@ -130,4 +140,4 @@ * // `instanceGroup` is an InstanceGroup object.

* instanceGroup.get().then(function(data) {
* var instanceGroup = data[0];
* var apiResponse = data[1];
* const instanceGroup = data[0];
* const apiResponse = data[1];
* });

@@ -140,5 +150,6 @@ */

*
* @resource [InstanceGroups: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/get}
* @resource [InstanceGroups Resource]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups}
* @see [InstanceGroups: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/get}
* @see [InstanceGroups Resource]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups}
*
* @method InstanceGroup#getMetadata
* @param {function=} callback - The callback function.

@@ -151,2 +162,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*
* instanceGroup.getMetadata(function(err, metadata, apiResponse) {});

@@ -158,7 +174,7 @@ *

* instanceGroup.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -169,8 +185,22 @@

baseUrl: '/instanceGroups',
/**
* @name InstanceGroup#id
* @type {string}
*/
id: name,
createMethod: zone.createInstanceGroup.bind(zone),
methods: methods
methods: methods,
});
/**
* The parent {@link Zone} instance of this {@link InstanceGroup} instance.
* @name InstanceGroup#zone
* @type {Zone}
*/
this.zone = zone;
/**
* @name InstanceGroup#name
* @type {string}
*/
this.name = name;

@@ -188,3 +218,3 @@ }

* and the value the port number.
* @return {object[]} - The formatted array of named ports.
* @returns {object[]} - The formatted array of named ports.
*/

@@ -195,3 +225,3 @@ InstanceGroup.formatPorts_ = function(ports) {

name: port,
port: ports[port]
port: ports[port],
};

@@ -204,9 +234,9 @@ });

*
* @resource [InstanceGroups: addInstances API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/addInstances}
* @see [InstanceGroups: addInstances API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/addInstances}
*
* @param {module:compute/vm|module:compute/vm[]} vms - VM instances to add to
* @param {VM|VM[]} vms - VM instances to add to
* this instance group.
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -216,3 +246,8 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var vms = [
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*
* const vms = [
* gce.zone('us-central1-a').vm('http-server'),

@@ -231,4 +266,4 @@ * gce.zone('us-central1-a').vm('https-server')

* instanceGroup.add(vms).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -239,23 +274,26 @@ */

this.request({
method: 'POST',
uri: '/addInstances',
json: {
instances: arrify(vms).map(function(vm) {
return {
instance: vm.url
};
})
}
}, function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/addInstances',
json: {
instances: arrify(vms).map(function(vm) {
return {
instance: vm.url,
};
}),
},
},
function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
var operation = self.zone.operation(resp.name);
operation.metadata = resp;
var operation = self.zone.operation(resp.name);
operation.metadata = resp;
callback(null, operation, resp);
});
callback(null, operation, resp);
}
);
};

@@ -266,7 +304,7 @@

*
* @resource [InstanceGroups: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/delete}
* @see [InstanceGroups: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -276,2 +314,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*
* instanceGroup.delete(function(err, operation, apiResponse) {

@@ -286,4 +329,4 @@ * // `operation` is an Operation object that can be used to check the status

* instanceGroup.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -312,3 +355,3 @@ */

*
* @resource [InstaceGroups: listInstances API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/listInstances}
* @see [InstaceGroups: listInstances API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/listInstances}
*

@@ -332,3 +375,3 @@ * @param {object=} options - Instance search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/vm[]} callback.vms - VM objects from this isntance
* @param {VM[]} callback.vms - VM objects from this instance
* group.

@@ -338,2 +381,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*
* instanceGroup.getVMs(function(err, vms) {

@@ -347,3 +395,3 @@ * // `vms` is an array of `VM` objects.

* //-
* function callback(err, vms, nextQuery, apiResponse) {
* function callback(err, vms, nextQuery, apiResponse) {
* if (nextQuery) {

@@ -363,3 +411,3 @@ * // More results exist.

* instanceGroup.getVMs().then(function(data) {
* var vms = data[0];
* const vms = data[0];
* });

@@ -381,44 +429,52 @@ */

body = {
instanceState: 'RUNNING'
instanceState: 'RUNNING',
};
}
this.request({
method: 'POST',
uri: '/listInstances',
qs: options,
json: body
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/listInstances',
qs: options,
json: body,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
var nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
var vms = arrify(resp.items).map(function(vm) {
var vmInstance = self.zone.vm(vm.instance);
vmInstance.metadata = vm;
return vmInstance;
});
callback(null, vms, nextQuery, resp);
}
var vms = arrify(resp.items).map(function(vm) {
var vmInstance = self.zone.vm(vm.instance);
vmInstance.metadata = vm;
return vmInstance;
});
callback(null, vms, nextQuery, resp);
});
);
};
/**
* Get a list of {module:compute/vm} instances in this instance group as a
* Get a list of {@link VM} instances in this instance group as a
* readable object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/instanceGroup#getVMs} for a complete list of options.
* @return {stream}
* {@link InstanceGroup#getVMs} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*
* instanceGroup.getVMsStream()

@@ -447,9 +503,9 @@ * .on('error', console.error)

*
* @resource [InstanceGroups: removeInstances API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/removeInstances}
* @see [InstanceGroups: removeInstances API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/removeInstances}
*
* @param {module:compute/vm|module:compute/vm[]} vms - VM instances to remove
* @param {VM|VM[]} vms - VM instances to remove
* from this instance group.
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -459,3 +515,8 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var vms = [
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*
* const vms = [
* gce.zone('us-central1-a').vm('http-server'),

@@ -474,4 +535,4 @@ * gce.zone('us-central1-a').vm('https-server')

* instanceGroup.remove(vms).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -482,23 +543,26 @@ */

this.request({
method: 'POST',
uri: '/removeInstances',
json: {
instances: arrify(vms).map(function(vm) {
return {
instance: vm.url
};
})
}
}, function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/removeInstances',
json: {
instances: arrify(vms).map(function(vm) {
return {
instance: vm.url,
};
}),
},
},
function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
var operation = self.zone.operation(resp.name);
operation.metadata = resp;
var operation = self.zone.operation(resp.name);
operation.metadata = resp;
callback(err, operation, resp);
});
callback(err, operation, resp);
}
);
};

@@ -509,3 +573,3 @@

*
* @resource [InstanceGroups: setNamedPorts API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/setNamedPorts}
* @see [InstanceGroups: setNamedPorts API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/setNamedPorts}
*

@@ -516,3 +580,3 @@ * @param {object} ports - A map of names to ports. The key should be the name,

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -522,3 +586,8 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var ports = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
* const instanceGroup = zone.instanceGroup('web-servers');
*
* const ports = {
* http: 80,

@@ -537,4 +606,4 @@ * https: 443

* instanceGroup.setPorts(ports).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -547,19 +616,22 @@ */

this.request({
method: 'POST',
uri: '/setNamedPorts',
json: {
namedPorts: InstanceGroup.formatPorts_(ports)
}
}, function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/setNamedPorts',
json: {
namedPorts: InstanceGroup.formatPorts_(ports),
},
},
function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
var operation = self.zone.operation(resp.name);
operation.metadata = resp;
var operation = self.zone.operation(resp.name);
operation.metadata = resp;
callback(null, operation, resp);
});
callback(null, operation, resp);
}
);
};

@@ -566,0 +638,0 @@

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/machine-type
*/
'use strict';

@@ -27,7 +23,2 @@

/*! Developer Documentation
*
* @param {module:zone} zone - Zone object this machine type belongs to.
* @param {string} name - Name of the machine type.
*/
/**

@@ -37,12 +28,14 @@ * A MachineType object allows you to interact with a Google Compute Engine

*
* @resource [Machine Types Overview]{@link https://cloud.google.com/compute/docs/machine-types}
* @resource [MachineType Resource]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes}
* @see [Machine Types Overview]{@link https://cloud.google.com/compute/docs/machine-types}
* @see [MachineType Resource]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes}
*
* @constructor
* @alias module:compute/machine-type
* @class
* @param {Zone} zone
* @param {string} name
*
* @example
* var zone = gce.zone('us-central1-b');
*
* var machineType = zone.machineType('g1-small');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-b');
* const machineType = zone.machineType('g1-small');
*/

@@ -54,2 +47,3 @@ function MachineType(zone, name) {

*
* @method MachineType#create
* @param {function} callback - The callback function.

@@ -62,2 +56,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-b');
* const machineType = zone.machineType('g1-small');
*
* machineType.exists(function(err, exists) {});

@@ -69,3 +68,3 @@ *

* machineType.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -78,3 +77,10 @@ */

*
* @method MachineType#get
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-b');
* const machineType = zone.machineType('g1-small');
*
* machineType.get(function(err, machineType, apiResponse) {

@@ -88,4 +94,4 @@ * // `machineType` is a MachineType object.

* machineType.get().then(function(data) {
* var machineType = data[0];
* var apiResponse = data[1];
* const machineType = data[0];
* const apiResponse = data[1];
* });

@@ -98,5 +104,6 @@ */

*
* @resource [MachineTypes: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes/get}
* @resource [MachineType Resource]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes}
* @see [MachineTypes: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes/get}
* @see [MachineType Resource]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes}
*
* @method MachineType#getMetadata
* @param {function=} callback - The callback function.

@@ -109,2 +116,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-b');
* const machineType = zone.machineType('g1-small');
*
* machineType.getMetadata(function(err, metadata, apiResponse) {});

@@ -116,7 +128,7 @@ *

* machineType.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -127,7 +139,21 @@

baseUrl: '/machineTypes',
/**
* @name MachineType#id
* @type {string}
*/
id: name,
methods: methods
methods: methods,
});
/**
* The parent {@link Zone} instance of this {@link MachineType} instance.
* @name MachineType#zone
* @type {Zone}
*/
this.zone = zone;
/**
* @name MachineType#name
* @type {string}
*/
this.name = name;

@@ -134,0 +160,0 @@ }

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/network
*/
'use strict';

@@ -30,18 +26,16 @@

/*! Developer Documentation
*
* @param {module:compute} compute - The Compute module this network belongs to.
* @param {string} name - Network name.
*/
/**
* A Network object allows you to interact with a Google Compute Engine network.
*
* @resource [Networks Overview]{@link https://cloud.google.com/compute/docs/networking#networks}
* @resource [Network Resource]{@link https://cloud.google.com/compute/docs/reference/v1/networks}
* @see [Networks Overview]{@link https://cloud.google.com/compute/docs/networking#networks}
* @see [Network Resource]{@link https://cloud.google.com/compute/docs/reference/v1/networks}
*
* @constructor
* @alias module:compute/network
* @class
* @param {Compute} compute
* @param {strign} name
*
* @example
* var network = gce.network('network-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*/

@@ -53,6 +47,11 @@ function Network(compute, name) {

*
* @param {object} config - See {module:compute#createNetwork}.
* @method Network#create
* @param {object} config - See {@link Compute#createNetwork}.
*
* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*
* const config = {
* // ...

@@ -73,5 +72,5 @@ * };

* network.create(config).then(function(data) {
* var network = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const network = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -84,2 +83,3 @@ */

*
* @method Network#exists
* @param {function} callback - The callback function.

@@ -91,2 +91,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*
* network.exists(function(err, exists) {});

@@ -98,3 +102,3 @@ *

* network.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -112,2 +116,3 @@ */

*
* @method Network#get
* @param {options=} options - Configuration object.

@@ -118,2 +123,6 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*
* network.get(function(err, network, apiResponse) {

@@ -127,4 +136,4 @@ * // `network` is a Network object.

* network.get().then(function(data) {
* var network = data[0];
* var apiResponse = data[1];
* const network = data[0];
* const apiResponse = data[1];
* });

@@ -137,5 +146,6 @@ */

*
* @resource [Network Resource]{@link https://cloud.google.com/compute/docs/reference/v1/networks}
* @resource [Networks: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/networks/delete}
* @see [Network Resource]{@link https://cloud.google.com/compute/docs/reference/v1/networks}
* @see [Networks: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/networks/delete}
*
* @method Network#getMetadata
* @param {function=} callback - The callback function.

@@ -148,2 +158,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*
* network.getMetadata(function(err, metadata, apiResponse) {});

@@ -155,7 +169,7 @@ *

* network.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -166,2 +180,6 @@

baseUrl: '/global/networks',
/**
* @name Network#id
* @type {string}
*/
id: name,

@@ -172,4 +190,17 @@ createMethod: compute.createNetwork.bind(compute),

/**
* The parent {@link Compute} instance of this {@link Network} instance.
* @name Network#compute
* @type {Compute}
*/
this.compute = compute;
/**
* @name Network#formattedName
* @type {string}
*/
this.formattedName = Network.formatName_(compute, name);
/**
* @name Network#name
* @type {string}
*/
this.name = name;

@@ -185,5 +216,5 @@ }

*
* @param {module:compute} compute - The Compute object this network belongs to.
* @param {Compute} compute - The Compute object this network belongs to.
* @param {string} name - The name of the network.
* @return {string} - The formatted name.
* @returns {string} - The formatted name.
*/

@@ -193,3 +224,3 @@ Network.formatName_ = function(compute, name) {

projectId: compute.projectId,
name: name
name: name,
});

@@ -201,4 +232,4 @@ };

*
* @resource [Firewalls Overview]{@link https://cloud.google.com/compute/docs/networking#firewalls}
* @resource [Firewalls: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls/insert}
* @see [Firewalls Overview]{@link https://cloud.google.com/compute/docs/networking#firewalls}
* @see [Firewalls: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls/insert}
*

@@ -217,5 +248,5 @@ * @param {string} name - Name of the firewall.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/firewall} callback.firewall - The created Firewall
* @param {Firewall} callback.firewall - The created Firewall
* object.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -225,3 +256,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*
* const config = {
* protocols: {

@@ -248,5 +283,5 @@ * tcp: [3000],

* network.createFirewall('new-firewall-name', config).then(function(data) {
* var firewall = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const firewall = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -256,3 +291,3 @@ */

config = extend({}, config, {
network: this.formattedName
network: this.formattedName,
});

@@ -266,4 +301,4 @@

*
* @resource [Subnetwork Resource]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks#resource}
* @resource [Subnetwork: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks/insert}
* @see [Subnetwork Resource]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks#resource}
* @see [Subnetwork: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks/insert}
*

@@ -273,3 +308,3 @@ * @param {string} name - Name of the subnetwork.

* [Subnetwork resource](https://cloud.google.com/compute/docs/reference/v1/subnetworks#resource).
* @param {module:compute/region|string} config.region - The region where the
* @param {Region|string} config.region - The region where the
* Subnetwork resides.

@@ -283,5 +318,5 @@ * @param {string} config.range - The range of internal addresses that

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/subnetwork} callback.subnetwork - The created
* @param {Subnetwork} callback.subnetwork - The created
* Subnetwork object.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -291,5 +326,8 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var region = gce.region('us-east1');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
* const region = compute.region('us-east1');
*
* var config = {
* const config = {
* region: region,

@@ -312,5 +350,5 @@ * range: '10.0.1.0/24'

* network.createSubnetwork('new-subnetwork-name', config).then(function(data) {
* var subnetwork = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const subnetwork = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -320,3 +358,3 @@ */

config = extend({}, config, {
network: this.formattedName
network: this.formattedName,
});

@@ -338,4 +376,4 @@

*
* @resource [Subnetworks Overview]{@link https://cloud.google.com/compute/docs/subnetworks}
* @resource [Subnetworks: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks}
* @see [Subnetworks Overview]{@link https://cloud.google.com/compute/docs/subnetworks}
* @see [Subnetworks: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks}
*

@@ -358,3 +396,3 @@ * @param {object=} options - Subnetwork search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/subnetwork[]} callback.subnetworks - Subnetwork
* @param {Subnetwork[]} callback.subnetworks - Subnetwork
* objects from this network.

@@ -364,2 +402,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*
* network.getSubnetworks(function(err, subnetworks) {

@@ -388,3 +430,3 @@ * // `subnetworks` is an array of `Subnetworks` objects.

* network.getSubnetworks().then(function(data) {
* var subnetworks = data[0];
* const subnetworks = data[0];
* });

@@ -399,3 +441,3 @@ */

options = extend({}, options, {
filter: 'network eq .*' + this.formattedName
filter: 'network eq .*' + this.formattedName,
});

@@ -407,10 +449,14 @@

/**
* Get a {module:compute/subnetwork} list within this network as a readable
* Get a {@link Subnetwork} list within this network as a readable
* object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/network#getSubnetworks} for a complete list of options.
* @return {stream}
* {@link Network#getSubnetworks} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*
* network.getSubnetworksStream()

@@ -436,3 +482,3 @@ * .on('error', console.error)

options = extend({}, options, {
filter: 'network eq .*' + this.formattedName
filter: 'network eq .*' + this.formattedName,
});

@@ -446,7 +492,7 @@

*
* @resource [Networks: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/networks/delete}
* @see [Networks: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/networks/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -456,2 +502,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*
* network.delete(function(err, operation, apiResponse) {

@@ -466,4 +516,4 @@ * // `operation` is an Operation object that can be used to check the status

* network.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -492,3 +542,3 @@ */

*
* @resource [Firewalls Overview]{@link https://cloud.google.com/compute/docs/networking#firewalls}
* @see [Firewalls Overview]{@link https://cloud.google.com/compute/docs/networking#firewalls}
*

@@ -498,3 +548,6 @@ * @param {string} name - Name of the firewall.

* @example
* var firewall = network.firewall('firewall-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
* const firewall = network.firewall('firewall-name');
*/

@@ -505,3 +558,3 @@ Network.prototype.firewall = function(name) {

firewall.metadata = {
network: this.formattedName
network: this.formattedName,
};

@@ -515,4 +568,4 @@

*
* @resource [Firewalls Overview]{@link https://cloud.google.com/compute/docs/networking#firewalls}
* @resource [Firewalls: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls/list}
* @see [Firewalls Overview]{@link https://cloud.google.com/compute/docs/networking#firewalls}
* @see [Firewalls: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/firewalls/list}
*

@@ -528,3 +581,3 @@ * @param {object=} options - Firewall search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/firewall[]} callback.firewalls - Firewall objects from
* @param {Firewall[]} callback.firewalls - Firewall objects from
* this network.

@@ -534,2 +587,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*
* network.getFirewalls(function(err, firewalls) {

@@ -558,3 +615,3 @@ * // `firewalls` is an array of `Firewall` objects.

* network.getFirewalls().then(function(data) {
* var firewalls = data[0];
* const firewalls = data[0];
* });

@@ -569,3 +626,3 @@ */

options = extend({}, options, {
filter: 'network eq .*' + this.formattedName
filter: 'network eq .*' + this.formattedName,
});

@@ -577,10 +634,14 @@

/**
* Get a list of {module:compute/firewall} objects for this network as a
* Get a list of {@link Firewall} objects for this network as a
* readable object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/network#getFirewalls} for a complete list of options.
* @return {stream}
* {@link Network#getFirewalls} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const network = compute.network('network-name');
*
* network.getFirewallsStream()

@@ -606,3 +667,3 @@ * .on('error', console.error)

options = extend({}, options, {
filter: 'network eq .*' + this.formattedName
filter: 'network eq .*' + this.formattedName,
});

@@ -619,5 +680,10 @@

common.util.promisifyAll(Network, {
exclude: ['firewall']
exclude: ['firewall'],
});
/**
* Reference to the {@link Network} class.
* @name module:@google-cloud/compute.Network
* @see Network
*/
module.exports = Network;

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/operation
*/
'use strict';

@@ -27,8 +23,2 @@

/*! Developer Documentation
*
* @param {module:compute} scope - The scope of the operation: a `Compute`,
* `Zone`, or `Region` object.
* @param {string} name - Operation name.
*/
/**

@@ -44,10 +34,15 @@ * An Operation object allows you to interact with a Google Compute Engine

*
* @constructor
* @alias module:compute/operation
* @class
* @param {Compute|Zone|Region} scope The scope of the operation: a `Compute`,
* `Zone`, or `Region` object.
* @param {string} name Operation name.
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
*
* //-
* // Reference a global operation.
* //-
* var operation = gce.operation('operation-id');
* const operation = compute.operation('operation-id');
*

@@ -57,4 +52,4 @@ * //-

* //-
* var region = gce.region('us-central1');
* var operation = region.operation('operation-id');
* const region = compute.region('us-central1');
* const operation = region.operation('operation-id');
*

@@ -64,4 +59,4 @@ * //-

* //-
* var zone = gce.zone('us-central1-a');
* var operation = zone.operation('operation-id');
* const zone = compute.zone('us-central1-a');
* const operation = zone.operation('operation-id');
*

@@ -106,6 +101,7 @@ * //-

*
* @resource [GlobalOperations: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalOperations/delete}
* @resource [RegionOperations: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations/delete}
* @resource [ZoneOperations: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations/delete}
* @see [GlobalOperations: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalOperations/delete}
* @see [RegionOperations: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations/delete}
* @see [ZoneOperations: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations/delete}
*
* @method Operation#delete
* @param {function=} callback - The callback function.

@@ -117,2 +113,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const operation = compute.operation('operation-id');
*
* operation.delete(function(err, apiResponse) {});

@@ -132,2 +132,3 @@ *

*
* @method Operation#exists
* @param {function} callback - The callback function.

@@ -139,2 +140,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const operation = compute.operation('operation-id');
*
* operation.exists(function(err, exists) {});

@@ -154,3 +159,8 @@ *

*
* @method Operation#get
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const operation = compute.operation('operation-id');
*
* operation.get(function(err, operation, apiResponse) {

@@ -168,3 +178,3 @@ * // `operation` is an Operation object.

*/
get: true
get: true,
};

@@ -175,6 +185,14 @@

baseUrl: isCompute ? '/global/operations' : '/operations',
/**
* @name Operation#id
* @type {string}
*/
id: name,
methods: methods
methods: methods,
});
/**
* @name Operation#name
* @type {string}
*/
this.name = name;

@@ -189,5 +207,5 @@ }

*
* @resource [GlobalOperations: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalOperations/get}
* @resource [RegionOperations: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations/get}
* @resource [ZoneOperations: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations/get}
* @see [GlobalOperations: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalOperations/get}
* @see [RegionOperations: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations/get}
* @see [ZoneOperations: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations/get}
*

@@ -200,2 +218,5 @@ * @param {function=} callback - The callback function.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
*
* operation.getMetadata(function(err, metadata, apiResponse) {

@@ -210,4 +231,4 @@ * // `metadata.error`: Contains errors if the operation failed.

* operation.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });

@@ -286,2 +307,7 @@ */

/**
* Reference to the {@link Operation} class.
* @name module:@google-cloud/compute.Operation
* @see Operation
*/
module.exports = Operation;

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/project
*/
'use strict';

@@ -27,6 +23,2 @@

/*! Developer Documentation
*
* @param {module:compute} compute - Compute object this project belongs to.
*/
/**

@@ -36,12 +28,18 @@ * A Project object allows you to interact with your Google Compute Engine

*
* @resource [Projects Overview]{@link https://cloud.google.com/compute/docs/projects}
* @resource [Projects Resource]{@link https://cloud.google.com/compute/docs/reference/v1/projects}
* @see [Projects Overview]{@link https://cloud.google.com/compute/docs/projects}
* @see [Projects Resource]{@link https://cloud.google.com/compute/docs/reference/v1/projects}
*
* @constructor
* @alias module:compute/project
* @class
* @param {Compute} compute - Compute object this project belongs to.
*
* @example
* var project = gce.project();
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const project = compute.project();
*/
function Project(compute) {
/**
* @name Project#id
* @type {string}
*/
this.id = compute.projectId;

@@ -53,3 +51,9 @@

*
* @method Operation#get
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const project = compute.project();
*
* project.get(function(err, project, apiResponse) {

@@ -63,4 +67,4 @@ * // `project` is a Project object.

* project.get().then(function(data) {
* var project = data[0];
* var apiResponse = data[1];
* const project = data[0];
* const apiResponse = data[1];
* });

@@ -73,5 +77,6 @@ */

*
* @resource [Projects: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/projects/get}
* @resource [Projects Resource]{@link https://cloud.google.com/compute/docs/reference/v1/projects}
* @see [Projects: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/projects/get}
* @see [Projects Resource]{@link https://cloud.google.com/compute/docs/reference/v1/projects}
*
* @method Operation#getMetadata
* @param {function=} callback - The callback function.

@@ -84,2 +89,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const project = compute.project();
*
* project.getMetadata(function(err, metadata, apiResponse) {});

@@ -95,3 +104,3 @@ *

*/
getMetadata: true
getMetadata: true,
};

@@ -103,3 +112,3 @@

id: '',
methods: methods
methods: methods,
});

@@ -117,2 +126,7 @@ }

/**
* Reference to the {@link Project} class.
* @name module:@google-cloud/compute.Project
* @see Project
*/
module.exports = Project;

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/region
*/
'use strict';

@@ -29,48 +25,22 @@

/**
* @type {module:compute/address}
* @private
*/
var Address = require('./address.js');
/**
* @type {module:compute/network}
* @private
*/
var Network = require('./network.js');
/**
* @type {module:compute/operation}
* @private
*/
var Operation = require('./operation.js');
/**
* @type {module:compute/rule}
* @private
*/
var Rule = require('./rule.js');
/**
* @type {module:compute/subnetwork}
* @private
*/
var Subnetwork = require('./subnetwork.js');
/*! Developer Documentation
*
* @param {module:compute} compute - Compute object this region belongs to.
* @param {string} name - Name of the region.
*/
/**
* A Region object allows you to interact with a Google Compute Engine region.
*
* @resource [Regions & Zones Overview]{@link https://cloud.google.com/compute/docs/zones}
* @resource [Region Resource]{@link https://cloud.google.com/compute/docs/reference/v1/regions}
* @see [Regions & Zones Overview]{@link https://cloud.google.com/compute/docs/zones}
* @see [Region Resource]{@link https://cloud.google.com/compute/docs/reference/v1/regions}
*
* @constructor
* @alias module:compute/region
* @class
* @param {Compute} compute
* @param {string} name
*
* @example
* var region = gce.region('us-central1');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*/

@@ -82,2 +52,3 @@ function Region(compute, name) {

*
* @method Region#exists
* @param {function} callback - The callback function.

@@ -89,2 +60,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.exists(function(err, exists) {});

@@ -96,3 +71,3 @@ *

* region.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -105,3 +80,9 @@ */

*
* @method Region#get
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.get(function(err, region, apiResponse) {

@@ -115,4 +96,4 @@ * // `region` is a Region object.

* region.get().then(function(data) {
* var region = data[0];
* var apiResponse = data[1];
* const region = data[0];
* const apiResponse = data[1];
* });

@@ -125,5 +106,6 @@ */

*
* @resource [Region Resource]{@link https://cloud.google.com/compute/docs/reference/v1/regions}
* @resource [Regions: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/regions/get}
* @see [Region Resource]{@link https://cloud.google.com/compute/docs/reference/v1/regions}
* @see [Regions: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/regions/get}
*
* @method Region#getMetadata
* @param {function=} callback - The callback function.

@@ -136,2 +118,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.getMetadata(function(err, metadata, apiResponse) {});

@@ -143,7 +129,7 @@ *

* region.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -154,6 +140,14 @@

baseUrl: '/regions',
/**
* @name Region#id
* @type {string}
*/
id: name,
methods: methods
methods: methods,
});
/**
* @name Region#name
* @type {string}
*/
this.name = name;

@@ -167,3 +161,3 @@

return reqOpts;
}
},
});

@@ -177,9 +171,13 @@ }

*
* @resource [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @see [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
*
* @param {string} name - Name of the address.
* @return {module:compute/address}
* @returns {Address}
*
* @example
* var address = region.address('address-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* const address = region.address('address-name');
*/

@@ -193,5 +191,5 @@ Region.prototype.address = function(name) {

*
* @resource [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @resource [Address Resource]{@link https://cloud.google.com/compute/docs/reference/v1/addresses}
* @resource [Addresses: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/addresses/insert}
* @see [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @see [Address Resource]{@link https://cloud.google.com/compute/docs/reference/v1/addresses}
* @see [Addresses: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/addresses/insert}
*

@@ -203,5 +201,5 @@ * @param {string} name - Name of the address.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/address} callback.address - The created Address
* @param {Address} callback.address - The created Address
* object.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -211,2 +209,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* function callback(err, address, operation, apiResponse) {

@@ -225,5 +227,5 @@ * // `address` is an Address object.

* region.createAddress('new-address').then(function(data) {
* var address = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const address = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -239,21 +241,24 @@ */

this.request({
method: 'POST',
uri: '/addresses',
json: extend({}, options, {
name: name
})
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/addresses',
json: extend({}, options, {
name: name,
}),
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var address = self.address(name);
var address = self.address(name);
var operation = self.operation(resp.name);
operation.metadata = resp;
var operation = self.operation(resp.name);
operation.metadata = resp;
callback(null, address, operation, resp);
});
callback(null, address, operation, resp);
}
);
};

@@ -264,4 +269,4 @@

*
* @resource [Subnetwork Resource]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks#resource}
* @resource [Subnetwork: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks/insert}
* @see [Subnetwork Resource]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks#resource}
* @see [Subnetwork: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks/insert}
*

@@ -271,3 +276,3 @@ * @param {string} name - Name of the subnetwork.

* [Subnetwork resource](https://cloud.google.com/compute/docs/reference/v1/subnetworks#resource).
* @param {module:compute/network|string} config.network - The network to which
* @param {Network|string} config.network - The network to which
* this subnetwork belongs. **Only networks that are in the distributed mode

@@ -281,5 +286,5 @@ * can have subnetworks.**

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/subnetwork} callback.subnetwork - The created
* @param {Subnetwork} callback.subnetwork - The created
* Subnetwork object.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -289,3 +294,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* const config = {
* network: 'network1',

@@ -308,5 +317,5 @@ * range: '10.0.1.0/24'

* region.createSubnetwork('new-subnetwork-name', config).then(function(data) {
* var subnetwork = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const subnetwork = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -318,3 +327,3 @@ */

var body = extend({}, config, {
name: name
name: name,
});

@@ -331,19 +340,22 @@

this.request({
method: 'POST',
uri: '/subnetworks',
json: body
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/subnetworks',
json: body,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var subnetwork = self.subnetwork(name);
var subnetwork = self.subnetwork(name);
var operation = self.operation(resp.name);
operation.metadata = resp;
var operation = self.operation(resp.name);
operation.metadata = resp;
callback(null, subnetwork, operation, resp);
});
callback(null, subnetwork, operation, resp);
}
);
};

@@ -354,4 +366,4 @@

*
* @resource [ForwardingRule Resource]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules#resource}
* @resource [ForwardingRules: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules/insert}
* @see [ForwardingRule Resource]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules#resource}
* @see [ForwardingRules: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules/insert}
*

@@ -380,4 +392,4 @@ * @param {string} name - Name of the rule.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/rule} callback.rule - The created Rule object.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Rule} callback.rule - The created Rule object.
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -387,5 +399,9 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var name = 'new-rule-name';
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* var cfg = {
* const name = 'new-rule-name';
*
* const cfg = {
* target: 'zones/us-central1-a/targetInstances/my-target-instance',

@@ -406,5 +422,5 @@ * range: '8080-8089'

* region.createRule(name, cfg).then(function(data) {
* var rule = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const rule = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -419,4 +435,4 @@ */

*
* @resource [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @resource [Addresses: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/addresses/list}
* @see [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @see [Addresses: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/addresses/list}
*

@@ -439,3 +455,3 @@ * @param {object=} options - Address search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/address[]} callback.addresses - Address objects from
* @param {Address[]} callback.addresses - Address objects from
* this region.

@@ -445,2 +461,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.getAddresses(function(err, addresses) {

@@ -469,3 +489,3 @@ * // `addresses` is an array of `Address` objects.

* region.getAddresses().then(function(data) {
* var addresses = data[0];
* const addresses = data[0];
* });

@@ -483,38 +503,45 @@ */

this.request({
uri: '/addresses',
qs: options
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
uri: '/addresses',
qs: options,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
var nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
var addresses = (resp.items || []).map(function(address) {
var addressInstance = self.address(address.name);
addressInstance.metadata = address;
return addressInstance;
});
callback(null, addresses, nextQuery, resp);
}
var addresses = (resp.items || []).map(function(address) {
var addressInstance = self.address(address.name);
addressInstance.metadata = address;
return addressInstance;
});
callback(null, addresses, nextQuery, resp);
});
);
};
/**
* Get a list of {module:compute/address} objects in this region as a readable
* Get a list of {@link Address} objects in this region as a readable
* object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/region#getAddresses} for a complete list of options.
* @return {stream}
* {@link Region#getAddresses} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.getAddressesStream()

@@ -538,4 +565,5 @@ * .on('error', console.error)

*/
Region.prototype.getAddressesStream =
common.paginator.streamify('getAddresses');
Region.prototype.getAddressesStream = common.paginator.streamify(
'getAddresses'
);

@@ -545,4 +573,4 @@ /**

*
* @resource [Region Operation Overview]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations}
* @resource [RegionOperations: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations/list}
* @see [Region Operation Overview]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations}
* @see [RegionOperations: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations/list}
*

@@ -565,3 +593,3 @@ * @param {object=} options - Operation search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation[]} callback.operations - Operation objects
* @param {Operation[]} callback.operations - Operation objects
* from this region.

@@ -571,2 +599,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.getOperations(function(err, operations) {

@@ -595,3 +627,3 @@ * // `operations` is an array of `Operation` objects.

* region.getOperations().then(function(data) {
* var operations = data[0];
* const operations = data[0];
* });

@@ -609,38 +641,45 @@ */

this.request({
uri: '/operations',
qs: options
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
uri: '/operations',
qs: options,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
var nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
var operations = (resp.items || []).map(function(operation) {
var operationInstance = self.operation(operation.name);
operationInstance.metadata = operation;
return operationInstance;
});
callback(null, operations, nextQuery, resp);
}
var operations = (resp.items || []).map(function(operation) {
var operationInstance = self.operation(operation.name);
operationInstance.metadata = operation;
return operationInstance;
});
callback(null, operations, nextQuery, resp);
});
);
};
/**
* Get a list of {module:compute/operation} objects for this region as a
* Get a list of {@link Operation} objects for this region as a
* readable object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/region#getOperations} for a complete list of options.
* @return {stream}
* {@link Region#getOperations} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.getOperationsStream()

@@ -664,4 +703,5 @@ * .on('error', console.error)

*/
Region.prototype.getOperationsStream =
common.paginator.streamify('getOperations');
Region.prototype.getOperationsStream = common.paginator.streamify(
'getOperations'
);

@@ -671,3 +711,3 @@ /**

*
* @resource [ForwardingRules: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules/list}
* @see [ForwardingRules: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules/list}
*

@@ -690,3 +730,3 @@ * @param {object=} options - Rules search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/rule[]} callback.rules - Rule objects from this
* @param {Rule[]} callback.rules - Rule objects from this
* region.

@@ -696,2 +736,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.getRules(function(err, rules) {

@@ -720,3 +764,3 @@ * // `rules` is an array of `Rule` objects.

* region.getRules().then(function(data) {
* var rules = data[0];
* const rules = data[0];
* });

@@ -734,38 +778,45 @@ */

this.request({
uri: '/forwardingRules',
qs: options
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
uri: '/forwardingRules',
qs: options,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
var nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
var rules = (resp.items || []).map(function(rule) {
var ruleInstance = self.rule(rule.name);
ruleInstance.metadata = rule;
return ruleInstance;
});
callback(null, rules, nextQuery, resp);
}
var rules = (resp.items || []).map(function(rule) {
var ruleInstance = self.rule(rule.name);
ruleInstance.metadata = rule;
return ruleInstance;
});
callback(null, rules, nextQuery, resp);
});
);
};
/**
* Get a list of {module:compute/rule} objects in this region as a readable
* Get a list of {@link Rule} objects in this region as a readable
* object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/region#getRulesStream} for a complete list of options.
* @return {stream}
* {@link Region#getRulesStream} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.getRulesStream()

@@ -794,4 +845,4 @@ * .on('error', console.error)

*
* @resource [Subnetworks Overview]{@link https://cloud.google.com/compute/docs/subnetworks}
* @resource [Subnetworks: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks}
* @see [Subnetworks Overview]{@link https://cloud.google.com/compute/docs/subnetworks}
* @see [Subnetworks: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks}
*

@@ -814,3 +865,3 @@ * @param {object=} options - Subnetwork search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/subnetwork[]} callback.subnetworks - Subnetwork
* @param {Subnetwork[]} callback.subnetworks - Subnetwork
* objects from this region.

@@ -820,2 +871,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.getSubnetworks(function(err, subnetworks) {

@@ -844,3 +899,3 @@ * // `subnetworks` is an array of `Subnetwork` objects.

* region.getSubnetworks().then(function(data) {
* var subnetworks = data[0];
* const subnetworks = data[0];
* });

@@ -858,38 +913,45 @@ */

this.request({
uri: '/subnetworks',
qs: options
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
uri: '/subnetworks',
qs: options,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
var nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
var subnetworks = (resp.items || []).map(function(subnetwork) {
var subnetworkInstance = self.subnetwork(subnetwork.name);
subnetworkInstance.metadata = subnetwork;
return subnetworkInstance;
});
callback(null, subnetworks, nextQuery, resp);
}
var subnetworks = (resp.items || []).map(function(subnetwork) {
var subnetworkInstance = self.subnetwork(subnetwork.name);
subnetworkInstance.metadata = subnetwork;
return subnetworkInstance;
});
callback(null, subnetworks, nextQuery, resp);
});
);
};
/**
* Get a list of {module:compute/subnetwork} objects in this region as a
* Get a list of {@link Subnetwork} objects in this region as a
* readable object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/region#getSubnetworks} for a complete list of options.
* @return {stream}
* {@link Region#getSubnetworks} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* region.getSubnetworksStream()

@@ -913,4 +975,5 @@ * .on('error', console.error)

*/
Region.prototype.getSubnetworksStream =
common.paginator.streamify('getSubnetworks');
Region.prototype.getSubnetworksStream = common.paginator.streamify(
'getSubnetworks'
);

@@ -920,9 +983,13 @@ /**

*
* @resource [Region Operation Overview]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations}
* @see [Region Operation Overview]{@link https://cloud.google.com/compute/docs/reference/v1/regionOperations}
*
* @param {string} name - Name of the existing operation.
* @return {module:compute/operation}
* @returns {Operation}
*
* @example
* var operation = region.operation('operation-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* const operation = region.operation('operation-name');
*/

@@ -937,6 +1004,10 @@ Region.prototype.operation = function(name) {

* @param {string} name - Name of the rule.
* @return {module:compute/rule}
* @returns {Rule}
*
* @example
* var rule = region.rule('rule-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* const rule = region.rule('rule-name');
*/

@@ -950,9 +1021,13 @@ Region.prototype.rule = function(name) {

*
* @resource [Subnetworks Overview]{@link https://cloud.google.com/compute/docs/subnetworks}
* @see [Subnetworks Overview]{@link https://cloud.google.com/compute/docs/subnetworks}
*
* @param {string} name - Name of the subnetwork.
* @return {module:compute/subnetwork}
* @returns {Subnetwork}
*
* @example
* var subnetwork = region.subnetwork('subnetwork-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('us-central1');
*
* const subnetwork = region.subnetwork('subnetwork-name');
*/

@@ -971,3 +1046,3 @@ Region.prototype.subnetwork = function(name) {

'getRules',
'getSubnetworks'
'getSubnetworks',
]);

@@ -981,10 +1056,10 @@

common.util.promisifyAll(Region, {
exclude: [
'address',
'operation',
'rule',
'subnetwork'
]
exclude: ['address', 'operation', 'rule', 'subnetwork'],
});
/**
* Reference to the {@link Region} class.
* @name module:@google-cloud/compute.Region
* @see Region
*/
module.exports = Region;

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/rule
*/
'use strict';

@@ -27,8 +23,2 @@

/*! Developer Documentation
*
* @param {module:compute|module:compute/region} scope - The parent scope this
* firewall rule belongs to.
* @param {string} name - Rule name.
*/
/**

@@ -41,12 +31,17 @@ * Forwarding rules work in conjunction with target pools and target instances

*
* @resource [Forwarding rules]{@link https://cloud.google.com/compute/docs/load-balancing/network/forwarding-rules}
* @see [Forwarding rules]{@link https://cloud.google.com/compute/docs/load-balancing/network/forwarding-rules}
*
* @constructor
* @alias module:compute/rule
* @class
* @param {Compute|Region} scope - The parent scope this
* firewall rule belongs to.
* @param {string} name - Rule name.
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
*
* //-
* // Reference a global rule.
* //-
* var rule = gce.rule('rule-name');
* const rule = compute.rule('rule-name');
*

@@ -56,4 +51,4 @@ * //-

* //-
* var region = gce.region('us-central1');
* var rule = region.rule('rule-name');
* const region = compute.region('us-central1');
* const rule = region.rule('rule-name');
*/

@@ -67,8 +62,13 @@ function Rule(scope, name) {

*
* @param {object} config - See {module:compute#createRule} or
* {module:compute/region#createRule} if accessing this object through
* @method Rule#create
* @param {object} config - See {@link Compute#createRule} or
* {@link Region#createRule} if accessing this object through
* a Region.
*
* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const rule = region.rule('rule-name');
*
* const config = {
* // `target` will be different depending of this is a Regional or Global

@@ -91,5 +91,5 @@ * // forwarding rule

* rule.create(config).then(function(data) {
* var rule = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const rule = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -102,2 +102,3 @@ */

*
* @method Rule#exists
* @param {function} callback - The callback function.

@@ -109,2 +110,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const rule = region.rule('rule-name');
*
* rule.exists(function(err, exists) {});

@@ -116,3 +121,3 @@ *

* rule.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -130,2 +135,3 @@ */

*
* @method Rule#get
* @param {options=} options - Configuration object.

@@ -136,2 +142,6 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const rule = region.rule('rule-name');
*
* rule.get(function(err, rule, apiResponse) {

@@ -145,4 +155,4 @@ * // `rule` is a Rule object.

* rule.get().then(function(data) {
* var rule = data[0];
* var apiResponse = data[1];
* const rule = data[0];
* const apiResponse = data[1];
* });

@@ -155,7 +165,8 @@ */

*
* @resource [GlobalForwardingRule Resource]{@link https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules#resource}
* @resource [ForwardingRule Resource]{@link https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules#resource}
* @resource [GlobalForwardingRules: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/get}
* @resource [ForwardingRules: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules/get}
* @see [GlobalForwardingRule Resource]{@link https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules#resource}
* @see [ForwardingRule Resource]{@link https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules#resource}
* @see [GlobalForwardingRules: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/get}
* @see [ForwardingRules: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules/get}
*
* @method Rule#getMetadata
* @param {function=} callback - The callback function.

@@ -168,2 +179,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const rule = region.rule('rule-name');
*
* rule.getMetadata(function(err, metadata, apiResponse) {});

@@ -175,7 +190,7 @@ *

* rule.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -186,7 +201,15 @@

baseUrl: (isGlobalRule ? '/global' : '') + '/forwardingRules',
/**
* @name Rule#id
* @type {string}
*/
id: name,
createMethod: scope.createRule.bind(scope),
methods: methods
methods: methods,
});
/**
* @name Rule#scope
* @type {Compute|Region}
*/
this.scope = scope;

@@ -200,8 +223,8 @@ }

*
* @resource [GlobalForwardingRules: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/delete}
* @resource [ForwardingRules: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules/delete}
* @see [GlobalForwardingRules: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/delete}
* @see [ForwardingRules: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -211,2 +234,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const rule = compute.rule('rule-name');
*
* rule.delete(function(err, operation, apiResponse) {

@@ -221,4 +248,4 @@ * // `operation` is an Operation object that can be used to check the status

* rule.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -247,4 +274,4 @@ */

*
* @resource [GlobalForwardingRules: setTarget API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/setTarget}
* @resource [ForwardingRules: setTarget API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules/setTarget}
* @see [GlobalForwardingRules: setTarget API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/setTarget}
* @see [ForwardingRules: setTarget API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/forwardingRules/setTarget}
*

@@ -261,2 +288,6 @@ * @param {string} target - The full or valid partial URL of the target resource

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const rule = compute.rule('rule-name');
*
* rule.setTarget('new-target', function(err, operation, apiResponse) {

@@ -271,4 +302,4 @@ * // `operation` is an Operation object that can be used to check the status

* rule.setTarget('new-target').then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -281,19 +312,22 @@ */

this.request({
method: 'POST',
uri: '/setTarget',
json: {
target: target
}
}, function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/setTarget',
json: {
target: target,
},
},
function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
var operation = scope.operation(resp.name);
operation.metadata = resp;
var operation = scope.operation(resp.name);
operation.metadata = resp;
callback(null, operation, resp);
});
callback(null, operation, resp);
}
);
};

@@ -308,2 +342,7 @@

/**
* Reference to the {@link Rule} class.
* @name module:@google-cloud/compute.Rule
* @see Rule
*/
module.exports = Rule;

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/service
*/
'use strict';

@@ -30,8 +26,2 @@

/*! Developer Documentation
*
* @param {module:compute} compute - The Compute instance this service inherits
* from.
* @param {string} name - Name of the service.
*/
/**

@@ -46,9 +36,13 @@ * An HTTP(S) load balancing backend service is a centralized service for

*
* @resource [Backend Services Overview]{@link https://cloud.google.com/compute/docs/load-balancing/http/backend-service}
* @see [Backend Services Overview]{@link https://cloud.google.com/compute/docs/load-balancing/http/backend-service}
*
* @constructor
* @alias module:compute/service
* @class
* @param {Compute} compute - The Compute instance this service inherits
* from.
* @param {string} name - Name of the service.
*
* @example
* var service = gce.service('service-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const service = const.service('service-name');
*/

@@ -60,6 +54,11 @@ function Service(compute, name) {

*
* @param {object} config - See {module:compute#createService}.
* @method Service#create
* @param {object} config - See {@link Compute#createService}.
*
* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const service = const.service('service-name');
*
* const config = {
* backends: [

@@ -86,5 +85,5 @@ * {

* service.create(config).then(function(data) {
* var service = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const service = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -97,2 +96,3 @@ */

*
* @method Service#exists
* @param {function} callback - The callback function.

@@ -105,2 +105,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const service = const.service('service-name');
*
* service.exists(function(err, exists) {});

@@ -112,3 +116,3 @@ *

* service.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -126,2 +130,3 @@ */

*
* @method Service#get
* @param {options=} options - Configuration object.

@@ -132,2 +137,6 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const service = const.service('service-name');
*
* service.get(function(err, service, apiResponse) {

@@ -141,4 +150,4 @@ * // `service` is a Service object.

* service.get().then(function(data) {
* var service = data[0];
* var apiResponse = data[1];
* const service = data[0];
* const apiResponse = data[1];
* });

@@ -151,5 +160,6 @@ */

*
* @resource [BackendService Resource]{@link https://cloud.google.com/compute/docs/reference/v1/backendServices#resource}
* @resource [BackendService: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/backendServices/get}
* @see [BackendService Resource]{@link https://cloud.google.com/compute/docs/reference/v1/backendServices#resource}
* @see [BackendService: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/backendServices/get}
*
* @method Service#getMetadata
* @param {function=} callback - The callback function.

@@ -162,2 +172,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const service = const.service('service-name');
*
* service.getMetadata(function(err, metadata, apiResponse) {});

@@ -169,7 +183,7 @@ *

* service.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -180,8 +194,21 @@

baseUrl: '/global/backendServices',
/**
* @name Service#id
* @type {string}
*/
id: name,
createMethod: compute.createService.bind(compute),
methods: methods
methods: methods,
});
/**
* The parent {@link Compute} instance of this {@link Service} instance.
* @name Service#compute
* @type {Compute}
*/
this.compute = compute;
/**
* @name Service#name
* @type {string}
*/
this.name = name;

@@ -195,7 +222,7 @@ }

*
* @resource [BackendServices: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/backendServices/delete}
* @see [BackendServices: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/backendServices/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -205,2 +232,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const service = const.service('service-name');
*
* service.delete(function(err, operation, apiResponse) {

@@ -215,4 +246,4 @@ * // `operation` is an Operation object that can be used to check the status

* service.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -241,3 +272,3 @@ */

*
* @resource [BackendServices: getHealth API Documentation]{@link https://cloud.google.com/compute/docs/reference/latest/backendServices/getHealth}
* @see [BackendServices: getHealth API Documentation]{@link https://cloud.google.com/compute/docs/reference/latest/backendServices/getHealth}
*

@@ -247,3 +278,3 @@ * @param {string|object} group - The fully-qualified URL of an Instance Group

* @param {string} group.name - The name of the Instance Group resource.
* @param {module:compute/zone|string} group.zone - The name of the zone or a
* @param {Zone|string} group.zone - The name of the zone or a
* Zone object.

@@ -257,3 +288,7 @@ * @param {function} callback - The callback function.

* @example
* var group = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const service = const.service('service-name');
*
* const group = {
* name: 'instance-group-name',

@@ -280,4 +315,4 @@ * zone: 'us-central1-a'

* service.getHealth(group).then(function(data) {
* var status = data[0];
* var apiResponse = data[1];
* const status = data[0];
* const apiResponse = data[1];
* });

@@ -291,20 +326,23 @@ */

z: group.zone.name || group.zone,
n: group.name
n: group.name,
});
}
this.request({
method: 'POST',
uri: '/getHealth',
json: {
group: group
this.request(
{
method: 'POST',
uri: '/getHealth',
json: {
group: group,
},
},
function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
callback(null, arrify(resp.healthStatus), resp);
}
}, function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
callback(null, arrify(resp.healthStatus), resp);
});
);
};

@@ -315,3 +353,3 @@

*
* @resource [BackendService Resource]{@link https://cloud.google.com/compute/docs/reference/v1/backendServices#resource}
* @see [BackendService Resource]{@link https://cloud.google.com/compute/docs/reference/v1/backendServices#resource}
*

@@ -322,3 +360,3 @@ * @param {object} metadata - See a

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -328,3 +366,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var metadata = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const service = const.service('service-name');
*
* const metadata = {
* description: 'New description'

@@ -342,4 +384,4 @@ * };

* service.setMetadata(metadata).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -352,17 +394,20 @@ */

this.request({
method: 'PATCH',
uri: '',
json: metadata
}, function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
this.request(
{
method: 'PATCH',
uri: '',
json: metadata,
},
function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
var operation = compute.operation(resp.name);
operation.metadata = resp;
var operation = compute.operation(resp.name);
operation.metadata = resp;
callback(null, operation, resp);
});
callback(null, operation, resp);
}
);
};

@@ -377,2 +422,7 @@

/**
* Reference to the {@link Service} class.
* @name module:@google-cloud/compute.Service
* @see Service
*/
module.exports = Service;

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/snapshot
*/
'use strict';

@@ -27,8 +23,2 @@

/*! Developer Documentation
*
* @param {module:compute|module:compute/disk} scope - The parent scope this
* snapshot belongs to. If it's a Disk, we expose the `create` methods.
* @param {string} name - Snapshot name.
*/
/**

@@ -38,10 +28,14 @@ * A Snapshot object allows you to interact with a Google Compute Engine

*
* @resource [Snapshots Overview]{@link https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots}
* @resource [Snapshot Resource]{@link https://cloud.google.com/compute/docs/reference/v1/snapshots}
* @see [Snapshots Overview]{@link https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots}
* @see [Snapshot Resource]{@link https://cloud.google.com/compute/docs/reference/v1/snapshots}
*
* @constructor
* @alias module:compute/snapshot
* @class
* @param {Compute|Disk} scope - The parent scope this
* snapshot belongs to. If it's a Disk, we expose the `create` methods.
* @param {string} name - Snapshot name.
*
* @example
* var snapshot = gce.snapshot('snapshot-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const snapshot = compute.snapshot('snapshot-name');
*

@@ -51,4 +45,4 @@ * //-

* //-
* var disk = gce.zone('us-central1-a').disk('disk-name');
* var snapshot = disk.snapshot('disk-snapshot-name');
* const disk = compute.zone('us-central1-a').disk('disk-name');
* const snapshot = disk.snapshot('disk-snapshot-name');
*/

@@ -62,2 +56,3 @@ function Snapshot(scope, name) {

*
* @method Snapshot#exists
* @param {function} callback - The callback function.

@@ -69,2 +64,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const snapshot = compute.snapshot('snapshot-name');
*
* snapshot.exists(function(err, exists) {});

@@ -82,2 +81,3 @@ */

*
* @method Snapshot#get
* @param {options=} options - Configuration object.

@@ -88,2 +88,6 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const snapshot = compute.snapshot('snapshot-name');
*
* snapshot.get(function(err, snapshot, apiResponse) {

@@ -97,4 +101,4 @@ * // `snapshot` is a Snapshot object.

* snapshot.get().then(function(data) {
* var snapshot = data[0];
* var apiResponse = data[1];
* const snapshot = data[0];
* const apiResponse = data[1];
* });

@@ -107,5 +111,6 @@ */

*
* @resource [Snapshot Resource]{@link https://cloud.google.com/compute/docs/reference/v1/snapshots}
* @resource [Snapshots: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/snapshots/get}
* @see [Snapshot Resource]{@link https://cloud.google.com/compute/docs/reference/v1/snapshots}
* @see [Snapshots: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/snapshots/get}
*
* @method Snapshot#getMetadata
* @param {function=} callback - The callback function.

@@ -118,2 +123,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const snapshot = compute.snapshot('snapshot-name');
*
* snapshot.getMetadata(function(err, metadata, apiResponse) {});

@@ -125,7 +134,7 @@ *

* snapshot.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -136,4 +145,8 @@

baseUrl: '/global/snapshots',
/**
* @name Snapshot#id
* @type {string}
*/
id: name,
methods: methods
methods: methods,
};

@@ -148,7 +161,12 @@

* **This is only available if you accessed this object through
* {module:compute/disk#snapshot}.**
* {@link Disk#snapshot}.**
*
* @param {object} config - See {module:compute/disk#createSnapshot}.
* @method Snapshot#create
* @param {object} config - See {@link Disk#createSnapshot}.
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const snapshot = compute.snapshot('snapshot-name');
*
* snapshot.create(function(err, snapshot, operation, apiResponse) {

@@ -161,3 +179,2 @@ * // `snapshot` is a Snapshot object.

*
*
* //-

@@ -167,5 +184,5 @@ * // If the callback is omitted, we'll return a Promise.

* snapshot.create().then(function(data) {
* var snapshot = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const snapshot = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -178,3 +195,11 @@ */

/**
* @name Snapshot#compute
* @type {Compute}
*/
this.compute = isDisk ? scope.compute : scope;
/**
* @name Snapshot#name
* @type {string}
*/
this.name = name;

@@ -188,7 +213,7 @@ }

*
* @resource [Snapshots: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/snapshots/delete}
* @see [Snapshots: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/snapshots/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -198,2 +223,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const snapshot = compute.snapshot('snapshot-name');
*
* snapshot.delete(function(err, operation, apiResponse) {

@@ -208,4 +237,4 @@ * // `operation` is an Operation object that can be used to check the status

* snapshot.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -238,2 +267,7 @@ */

/**
* Reference to the {@link Snapshot} class.
* @name module:@google-cloud/compute.Snapshot
* @see Snapshot
*/
module.exports = Snapshot;

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/subnetwork
*/
'use strict';

@@ -27,7 +23,2 @@

/*! Developer Documentation
*
* @param {module:region} region - Region this subnetwork belongs to.
* @param {string} name - Name of the subnetwork.
*/
/**

@@ -37,15 +28,26 @@ * An Subnetwork object allows you to interact with a Google Compute Engine

*
* @resource [Subnetworks Overview]{@link https://cloud.google.com/compute/docs/subnetworks}
* @resource [Subnetwork Resource]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks}
* @see [Subnetworks Overview]{@link https://cloud.google.com/compute/docs/subnetworks}
* @see [Subnetwork Resource]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks}
*
* @constructor
* @alias module:compute/subnetwork
* @class
* @param {Region} region - Region this subnetwork belongs to.
* @param {string} name - Name of the subnetwork.
*
* @example
* var region = gce.region('region-name');
*
* var subnetwork = region.subnetwork('subnetwork1');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const subnetwork = region.subnetwork('subnetwork1');
*/
function Subnetwork(region, name) {
/**
* @name Subnetwork#name
* @type {string}
*/
this.name = name;
/**
* The parent {@link Region} instance of this {@link Subnetwork} instance.
* @name Subnetwork#region
* @type {Region}
*/
this.region = region;

@@ -57,6 +59,12 @@

*
* @param {object} config - See {module:compute/region#createSubnetwork}.
* @method Subnetwork#create
* @param {object} config - See {@link Region#createSubnetwork}.
*
* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const subnetwork = region.subnetwork('subnetwork1');
*
* const config = {
* // ...

@@ -78,5 +86,5 @@ * };

* subnetwork.create(config).then(function(data) {
* var subnetwork = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const subnetwork = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -89,2 +97,3 @@ */

*
* @method Subnetwork#exists
* @param {function} callback - The callback function.

@@ -96,2 +105,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const subnetwork = region.subnetwork('subnetwork1');
*
* subnetwork.exists(function(err, exists) {});

@@ -103,3 +117,3 @@ *

* subnetwork.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -117,2 +131,3 @@ */

*
* @method Subnetwork#get
* @param {options=} options - Configuration object.

@@ -123,2 +138,7 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const subnetwork = region.subnetwork('subnetwork1');
*
* subnetwork.get(function(err, subnetwork, apiResponse) {

@@ -132,4 +152,4 @@ * // `subnetwork` is a Subnetwork object.

* subnetwork.get().then(function(data) {
* var subnetwork = data[0];
* var apiResponse = data[1];
* const subnetwork = data[0];
* const apiResponse = data[1];
* });

@@ -142,5 +162,6 @@ */

*
* @resource [Subnetwork Resource]{@link https://cloud.google.com/compute/docs/reference/v1/subnetwork}
* @resource [Subnetwork: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetwork/get}
* @see [Subnetwork Resource]{@link https://cloud.google.com/compute/docs/reference/v1/subnetwork}
* @see [Subnetwork: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetwork/get}
*
* @method Subnetwork#getMetadata
* @param {function=} callback - The callback function.

@@ -153,2 +174,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const subnetwork = region.subnetwork('subnetwork1');
*
* subnetwork.getMetadata(function(err, metadata, apiResponse) {});

@@ -160,7 +186,7 @@ *

* subnetwork.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -173,3 +199,3 @@

createMethod: region.createSubnetwork.bind(region),
methods: methods
methods: methods,
});

@@ -183,7 +209,7 @@ }

*
* @resource [Subnetworks: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks/delete}
* @see [Subnetworks: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -193,2 +219,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const region = compute.region('region-name');
* const subnetwork = region.subnetwork('subnetwork1');
*
* subnetwork.delete(function(err, operation, apiResponse) {

@@ -203,4 +234,4 @@ * // `operation` is an Operation object that can be used to check the status

* subnetwork.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -213,16 +244,19 @@ */

this.request({
method: 'DELETE',
uri: ''
}, function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
this.request(
{
method: 'DELETE',
uri: '',
},
function(err, resp) {
if (err) {
callback(err, null, resp);
return;
}
var operation = region.operation(resp.name);
operation.metadata = resp;
var operation = region.operation(resp.name);
operation.metadata = resp;
callback(null, operation, resp);
});
callback(null, operation, resp);
}
);
};

@@ -229,0 +263,0 @@

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/vm
*/
'use strict';

@@ -31,6 +27,2 @@

/**
* @type {module:compute/disk}
* @private
*/
var Disk = require('./disk.js');

@@ -44,3 +36,3 @@

* @param {string} message - Custom error message.
* @return {Error}
* @returns {Error}
*/

@@ -56,3 +48,3 @@ var DetachDiskError = createErrorClass('DetachDiskError');

* @param {string} message - Custom error message.
* @return {Error}
* @returns {Error}
*/

@@ -73,3 +65,3 @@ var WaitForTimeoutError = createErrorClass('WaitForTimeoutError');

'SUSPENDED',
'TERMINATED'
'TERMINATED',
];

@@ -84,7 +76,2 @@

/*! Developer Documentation
*
* @param {module:zone} zone - Zone object this instance belongs to.
* @param {string} name - Name of the instance.
*/
/**

@@ -94,15 +81,26 @@ * An Instance object allows you to interact with a Google Compute Engine

*
* @resource [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @resource [Instance Resource]{@link https://cloud.google.com/compute/docs/reference/v1/instances}
* @see [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @see [Instance Resource]{@link https://cloud.google.com/compute/docs/reference/v1/instances}
*
* @constructor
* @alias module:compute/vm
* @class
* @param {Zone} zone - Zone object this instance belongs to.
* @param {string} name - Name of the instance.
*
* @example
* var zone = gce.zone('zone-name');
*
* var vm = zone.vm('vm-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*/
function VM(zone, name) {
/**
* @name VM#name
* @type {string}
*/
this.name = name.replace(/.*\/([^/]+)$/, '$1'); // Just the instance name.
/**
* The parent {@link Zone} instance of this {@link VM} instance.
* @name VM#zone
* @type {Zone}
*/
this.zone = zone;

@@ -117,3 +115,3 @@

zone: zone.name,
name: this.name
name: this.name,
});

@@ -125,6 +123,12 @@

*
* @param {object} config - See {module:compute/zone#createVM}.
* @method VM#create
* @param {object} config - See {Zone#createVM}.
*
* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* const config = {
* // ...

@@ -144,5 +148,5 @@ * };

* vm.create(config).then(function(data) {
* var vm = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const vm = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -155,2 +159,3 @@ */

*
* @method VM#exists
* @param {function} callback - The callback function.

@@ -162,2 +167,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.exists(function(err, exists) {});

@@ -169,3 +179,3 @@ *

* vm.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -183,2 +193,3 @@ */

*
* @method VM#get
* @param {options=} options - Configuration object.

@@ -189,2 +200,7 @@ * @param {boolean} options.autoCreate - Automatically create the object if

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.get(function(err, vm, apiResponse) {

@@ -198,4 +214,4 @@ * // `vm` is a VM object.

* vm.get().then(function(data) {
* var vm = data[0];
* var apiResponse = data[1];
* const vm = data[0];
* const apiResponse = data[1];
* });

@@ -208,5 +224,6 @@ */

*
* @resource [Instance Resource]{@link https://cloud.google.com/compute/docs/reference/v1/instances}
* @resource [Instance: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/get}
* @see [Instance Resource]{@link https://cloud.google.com/compute/docs/reference/v1/instances}
* @see [Instance: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/get}
*
* @method VM#getMetadata
* @param {function=} callback - The callback function.

@@ -219,2 +236,7 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.getMetadata(function(err, metadata, apiResponse) {});

@@ -226,7 +248,7 @@ *

* vm.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -237,5 +259,9 @@

baseUrl: '/instances',
/**
* @name VM#id
* @type {string}
*/
id: this.name,
createMethod: zone.createVM.bind(zone),
methods: methods
methods: methods,
});

@@ -249,5 +275,5 @@ }

*
* @resource [Disks Overview]{@link https://cloud.google.com/compute/docs/disks}
* @resource [Disk Resource]{@link https://cloud.google.com/compute/docs/reference/v1/disks}
* @resource [Instance: attachDisk API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/attachDisk}
* @see [Disks Overview]{@link https://cloud.google.com/compute/docs/disks}
* @see [Disk Resource]{@link https://cloud.google.com/compute/docs/reference/v1/disks}
* @see [Instance: attachDisk API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/attachDisk}
*

@@ -264,3 +290,3 @@ * @throws {Error} if a {module:compute/disk} is not provided.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -270,4 +296,9 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var disk = zone.disk('my-disk');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* const disk = zone.disk('my-disk');
*
* function callback(err, operation, apiResponse) {

@@ -283,3 +314,3 @@ * // `operation` is an Operation object that can be used to check the status

* //-
* var options = {
* const options = {
* autoDelete: true,

@@ -295,4 +326,4 @@ * readOnly: true

* vm.attachDisk(disk, options).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -310,8 +341,12 @@ */

var body = extend({
// Default the deviceName to the name of the disk, like the Console does.
deviceName: disk.name
}, options, {
source: disk.formattedName
});
var body = extend(
{
// Default the deviceName to the name of the disk, like the Console does.
deviceName: disk.name,
},
options,
{
source: disk.formattedName,
}
);

@@ -323,7 +358,10 @@ if (body.readOnly) {

this.request({
method: 'POST',
uri: '/attachDisk',
json: body
}, callback);
this.request(
{
method: 'POST',
uri: '/attachDisk',
json: body,
},
callback
);
};

@@ -334,7 +372,7 @@

*
* @resource [Instance: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/delete}
* @see [Instance: delete API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/delete}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -344,2 +382,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.delete(function(err, operation, apiResponse) {

@@ -354,11 +397,14 @@ * // `operation` is an Operation object that can be used to check the status

* vm.delete().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });
*/
VM.prototype.delete = function(callback) {
this.request({
method: 'DELETE',
uri: ''
}, callback || common.util.noop);
this.request(
{
method: 'DELETE',
uri: '',
},
callback || common.util.noop
);
};

@@ -369,3 +415,3 @@

*
* @resource [Instance: detachDisk API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/detachDisk}
* @see [Instance: detachDisk API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/detachDisk}
*

@@ -377,3 +423,3 @@ * @param {module:compute/disk|string} deviceName - The device name of the disk

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -383,4 +429,9 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var disk = zone.disk('my-disk');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* const disk = zone.disk('my-disk');
*
* vm.detachDisk(disk, function(err, operation, apiResponse) {

@@ -395,4 +446,4 @@ * // `operation` is an Operation object that can be used to check the status

* vm.detachDisk(disk).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -438,9 +489,12 @@ */

self.request({
method: 'POST',
uri: '/detachDisk',
qs: {
deviceName: deviceName
}
}, callback || common.util.noop);
self.request(
{
method: 'POST',
uri: '/detachDisk',
qs: {
deviceName: deviceName,
},
},
callback || common.util.noop
);
});

@@ -452,3 +506,3 @@ };

*
* @resource [Instances: getSerialPortOutput API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/getSerialPortOutput}
* @see [Instances: getSerialPortOutput API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/getSerialPortOutput}
*

@@ -463,2 +517,7 @@ * @param {number=} port - The port from which the output is retrieved (1-4).

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.getSerialPortOutput(function(err, output, apiResponse) {});

@@ -470,4 +529,4 @@ *

* vm.getSerialPortOutput().then(function(data) {
* var output = data[0];
* var apiResponse = data[1];
* const output = data[0];
* const apiResponse = data[1];
* });

@@ -484,4 +543,4 @@ */

qs: {
port: port
}
port: port,
},
};

@@ -514,2 +573,7 @@

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.getTags(function(err, tags, fingerprint, apiResponse) {});

@@ -521,5 +585,5 @@ *

* vm.getTags().then(function(data) {
* var tags = data[0];
* var fingerprint = data[1];
* var apiResponse = data[2];
* const tags = data[0];
* const fingerprint = data[1];
* const apiResponse = data[2];
* });

@@ -541,7 +605,7 @@ */

*
* @resource [Instances: reset API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/reset}
* @see [Instances: reset API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/reset}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -551,2 +615,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.reset(function(err, operation, apiResponse) {

@@ -561,11 +630,14 @@ * // `operation` is an Operation object that can be used to check the status

* vm.reset().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });
*/
VM.prototype.reset = function(callback) {
this.request({
method: 'POST',
uri: '/reset'
}, callback || common.util.noop);
this.request(
{
method: 'POST',
uri: '/reset',
},
callback || common.util.noop
);
};

@@ -585,4 +657,4 @@

*
* @resource [Instances: setMachineType API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/setMachineType}
* @resource [Predefined machine types]{@link https://cloud.google.com/compute/docs/machine-types#predefined_machine_types}
* @see [Instances: setMachineType API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/setMachineType}
* @see [Predefined machine types]{@link https://cloud.google.com/compute/docs/machine-types#predefined_machine_types}
*

@@ -600,2 +672,7 @@ * @param {string} machineType - Full or partial machine type. See a list of

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.resize('n1-standard-1', function(err, apiResponse) {

@@ -612,3 +689,3 @@ * if (!err) {

* //-
* var options = {
* const options = {
* start: false

@@ -627,3 +704,3 @@ * };

* vm.resize('ns-standard-1', options).then(function(data) {
* var apiResponse = data[0];
* const apiResponse = data[0];
* });

@@ -647,38 +724,43 @@ */

zoneName: this.zone.name,
machineType: machineType
machineType: machineType,
});
}
this.request({
method: 'POST',
uri: '/setMachineType',
json: {
machineType: machineType
}
}, compute.execAfterOperation_(function(err, apiResponse) {
if (err) {
if (err.message === 'Instance is starting or running.') {
// The instance must be stopped before its machine type can be set.
self.stop(compute.execAfterOperation_(function(err, apiResponse) {
if (err) {
callback(err, apiResponse);
return;
}
this.request(
{
method: 'POST',
uri: '/setMachineType',
json: {
machineType: machineType,
},
},
compute.execAfterOperation_(function(err, apiResponse) {
if (err) {
if (err.message === 'Instance is starting or running.') {
// The instance must be stopped before its machine type can be set.
self.stop(
compute.execAfterOperation_(function(err, apiResponse) {
if (err) {
callback(err, apiResponse);
return;
}
// Try again now that the instance is stopped.
self.resize(machineType, callback);
}));
// Try again now that the instance is stopped.
self.resize(machineType, callback);
})
);
} else {
callback(err, apiResponse);
}
return;
}
// The machine type was changed successfully.
if (options.start === false) {
callback(null, apiResponse);
} else {
callback(err, apiResponse);
self.start(compute.execAfterOperation_(callback));
}
return;
}
// The machine type was changed successfully.
if (options.start === false) {
callback(null, apiResponse);
} else {
self.start(compute.execAfterOperation_(callback));
}
}));
})
);
};

@@ -689,3 +771,3 @@

*
* @resource [Instances: setMetadata API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/setMetadata}
* @see [Instances: setMetadata API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/setMetadata}
*

@@ -695,3 +777,3 @@ * @param {object} metadata - New metadata.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -701,3 +783,8 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var metadata = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* const metadata = {
* 'startup-script': '...'

@@ -715,4 +802,4 @@ * };

* vm.setMetadata(metadata).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -733,3 +820,3 @@ */

fingerprint: currentMetadata.metadata.fingerprint,
items: []
items: [],
};

@@ -741,3 +828,3 @@

key: prop,
value: metadata[prop]
value: metadata[prop],
});

@@ -747,7 +834,10 @@ }

self.request({
method: 'POST',
uri: '/setMetadata',
json: newMetadata
}, callback);
self.request(
{
method: 'POST',
uri: '/setMetadata',
json: newMetadata,
},
callback
);
});

@@ -759,3 +849,3 @@ };

*
* @resource [Instances: setTags API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/setTags}
* @see [Instances: setTags API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/setTags}
*

@@ -767,3 +857,3 @@ * @param {string[]} tags - The new tags for the instance.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -773,2 +863,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.getTags(function(err, tags, fingerprint) {

@@ -787,4 +882,4 @@ * tags.push('new-tag');

* vm.getTags().then(function(data) {
* var tags = data[0];
* var fingerprint = data[1];
* const tags = data[0];
* const fingerprint = data[1];
*

@@ -795,4 +890,4 @@ * tags.push('new-tag');

* }).then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });

@@ -803,10 +898,13 @@ */

items: tags,
fingerprint: fingerprint
fingerprint: fingerprint,
};
this.request({
method: 'POST',
uri: '/setTags',
json: body
}, callback || common.util.noop);
this.request(
{
method: 'POST',
uri: '/setTags',
json: body,
},
callback || common.util.noop
);
};

@@ -817,7 +915,7 @@

*
* @resource [Instances: start API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/start}
* @see [Instances: start API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/start}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -827,2 +925,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.start(function(err, operation, apiResponse) {

@@ -837,11 +940,14 @@ * // `operation` is an Operation object that can be used to check the status

* vm.start().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });
*/
VM.prototype.start = function(callback) {
this.request({
method: 'POST',
uri: '/start'
}, callback || common.util.noop);
this.request(
{
method: 'POST',
uri: '/start',
},
callback || common.util.noop
);
};

@@ -852,7 +958,7 @@

*
* @resource [Instances: stop API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/stop}
* @see [Instances: stop API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/stop}
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -862,2 +968,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.stop(function(err, operation, apiResponse) {

@@ -872,11 +983,14 @@ * // `operation` is an Operation object that can be used to check the status

* vm.stop().then(function(data) {
* var operation = data[0];
* var apiResponse = data[1];
* const operation = data[0];
* const apiResponse = data[1];
* });
*/
VM.prototype.stop = function(callback) {
this.request({
method: 'POST',
uri: '/stop'
}, callback || common.util.noop);
this.request(
{
method: 'POST',
uri: '/stop',
},
callback || common.util.noop
);
};

@@ -906,2 +1020,7 @@

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('zone-name');
* const vm = zone.vm('vm-name');
*
* vm.waitFor('RUNNING', function(err, metadata) {

@@ -919,3 +1038,3 @@ * if (!err) {

* //-
* var options = {
* const options = {
* timeout: 600

@@ -934,3 +1053,3 @@ * };

* vm.waitFor('RUNNING', options).then(function(data) {
* var metadata = data[0];
* const metadata = data[0];
* });

@@ -964,3 +1083,3 @@ */

startTime: new Date() / 1000,
callback: callback
callback: callback,
});

@@ -1005,6 +1124,8 @@

if (now - waiter.startTime >= waiter.timeout) {
var waitForTimeoutError = new WaitForTimeoutError([
'waitFor timed out waiting for VM ' + self.name,
'to be in status: ' + waiter.status
].join(' '));
var waitForTimeoutError = new WaitForTimeoutError(
[
'waitFor timed out waiting for VM ' + self.name,
'to be in status: ' + waiter.status,
].join(' ')
);
waiter.callback(waitForTimeoutError);

@@ -1027,3 +1148,2 @@ return true;

/**

@@ -1030,0 +1150,0 @@ * Make a new request object from the provided arguments and wrap the callback

@@ -17,6 +17,2 @@ /*!

/*!
* @module compute/zone
*/
'use strict';

@@ -33,54 +29,23 @@

/**
* @type {module:compute/autoscaler}
* @private
*/
var Autoscaler = require('./autoscaler.js');
/**
* @type {module:compute/disk}
* @private
*/
var Disk = require('./disk.js');
/**
* @type {module:compute/instance-group}
* @private
*/
var InstanceGroup = require('./instance-group.js');
/**
* @type {module:compute/machine-type}
* @private
*/
var MachineType = require('./machine-type.js');
/**
* @type {module:compute/operation}
* @private
*/
var Operation = require('./operation.js');
/**
* @type {module:compute/vm}
* @private
*/
var VM = require('./vm.js');
/*! Developer Documentation
*
* @param {module:compute} compute - Compute object this zone belongs to.
* @param {string} name - Name of the zone.
*/
/**
* A Zone object allows you to interact with a Google Compute Engine zone.
*
* @resource [Regions & Zones Overview]{@link https://cloud.google.com/compute/docs/zones}
* @resource [Zone Resource]{@link https://cloud.google.com/compute/docs/reference/v1/zones}
* @see [Regions & Zones Overview]{@link https://cloud.google.com/compute/docs/zones}
* @see [Zone Resource]{@link https://cloud.google.com/compute/docs/reference/v1/zones}
*
* @constructor
* @alias module:compute/zone
* @class
* @param {Compute} compute - Compute object this zone belongs to.
* @param {string} name - Name of the zone.
*
* @example
* var zone = gce.zone('us-central1-a');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*/

@@ -92,2 +57,3 @@ function Zone(compute, name) {

*
* @method Zone#exists
* @param {function} callback - The callback function.

@@ -99,2 +65,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.exists(function(err, exists) {});

@@ -106,3 +76,3 @@ *

* zone.exists().then(function(data) {
* var exists = data[0];
* const exists = data[0];
* });

@@ -115,3 +85,9 @@ */

*
* @method Zone#get
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.get(function(err, zone, apiResponse) {

@@ -125,4 +101,4 @@ * // `zone` is a Zone object.

* zone.get().then(function(data) {
* var zone = data[0];
* var apiResponse = data[1];
* const zone = data[0];
* const apiResponse = data[1];
* });

@@ -135,5 +111,6 @@ */

*
* @resource [Zone Resource]{@link https://cloud.google.com/compute/docs/reference/v1/zones}
* @resource [Zones: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/zones/get}
* @see [Zone Resource]{@link https://cloud.google.com/compute/docs/reference/v1/zones}
* @see [Zones: get API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/zones/get}
*
* @method Zone#getMetadata
* @param {function=} callback - The callback function.

@@ -146,2 +123,6 @@ * @param {?error} callback.err - An error returned while making this

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getMetadata(function(err, metadata, apiResponse) {});

@@ -153,7 +134,7 @@ *

* zone.getMetadata().then(function(data) {
* var metadata = data[0];
* var apiResponse = data[1];
* const metadata = data[0];
* const apiResponse = data[1];
* });
*/
getMetadata: true
getMetadata: true,
};

@@ -164,11 +145,25 @@

baseUrl: '/zones',
/**
* @name Zone#id
* @type {string}
*/
id: name,
methods: methods
methods: methods,
});
/**
* The parent {@link Compute} instance of this {@link Zone} instance.
* @name Zone#compute
* @type {Compute}
*/
this.compute = compute;
/**
* @name Zone#name
* @type {string}
*/
this.name = name;
this.gceImages = gceImages({
authClient: compute.authClient
authClient: compute.authClient,
});

@@ -183,6 +178,10 @@ }

* @param {string} name - Name of the autoscaler.
* @return {module:compute/autoscaler}
* @returns {Autoscaler}
*
* @example
* var autoscaler = zone.autoscaler('autoscaler-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* const autoscaler = zone.autoscaler('autoscaler-name');
*/

@@ -196,5 +195,5 @@ Zone.prototype.autoscaler = function(name) {

*
* @resource [Load Balancing and Scaling]{@link https://cloud.google.com/compute/docs/load-balancing-and-autoscaling}
* @resource [Autoscaler Resource]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers}
* @resource [Autoscalers: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers/insert}
* @see [Load Balancing and Scaling]{@link https://cloud.google.com/compute/docs/load-balancing-and-autoscaling}
* @see [Autoscaler Resource]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers}
* @see [Autoscalers: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers/insert}
*

@@ -225,5 +224,5 @@ * @throws {Error} If `config.target` is not provided.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/autoscaler} callback.autoscaler - The created
* @param {Autoscaler} callback.autoscaler - The created
* Autoscaler object.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -233,3 +232,7 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* var config = {
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* const config = {
* coolDown: 30,

@@ -256,5 +259,5 @@ * cpu: 80,

* zone.createAutoscaler('name', config).then(function(data) {
* var autoscaler = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const autoscaler = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -271,3 +274,3 @@ */

name: name,
autoscalingPolicy: {}
autoscalingPolicy: {},
});

@@ -282,3 +285,3 @@

'/instanceGroupManagers/',
json.target
json.target,
].join('');

@@ -294,3 +297,3 @@ }

json.autoscalingPolicy.cpuUtilization = {
utilizationTarget: json.cpu / 100
utilizationTarget: json.cpu / 100,
};

@@ -302,3 +305,3 @@ delete json.cpu;

json.autoscalingPolicy.loadBalancingUtilization = {
utilizationTarget: json.loadBalance / 100
utilizationTarget: json.loadBalance / 100,
};

@@ -318,19 +321,22 @@ delete json.loadBalance;

this.request({
method: 'POST',
uri: '/autoscalers',
json: json
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/autoscalers',
json: json,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var autoscaler = self.autoscaler(name);
var autoscaler = self.autoscaler(name);
var operation = self.operation(resp.name);
operation.metadata = resp;
var operation = self.operation(resp.name);
operation.metadata = resp;
callback(null, autoscaler, operation, resp);
});
callback(null, autoscaler, operation, resp);
}
);
};

@@ -341,4 +347,4 @@

*
* @resource [Disk Resource]{@link https://cloud.google.com/compute/docs/reference/v1/disks}
* @resource [Disks: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/disks/insert}
* @see [Disk Resource]{@link https://cloud.google.com/compute/docs/reference/v1/disks}
* @see [Disks: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/disks/insert}
*

@@ -353,4 +359,4 @@ * @param {string} name - Name of the disk.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/disk} callback.disk - The created Disk object.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Disk} callback.disk - The created Disk object.
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -360,2 +366,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* //-

@@ -365,3 +375,3 @@ * // Create a persistent disk using the latest Ubuntu version

* //-
* var config = {
* const config = {
* os: 'ubuntu',

@@ -375,3 +385,3 @@ * sizeGb: 10

* //-
* var config = {
* const config = {
* os: 'your-project-id-or-name/ubuntu',

@@ -392,5 +402,5 @@ * sizeGb: 10

* zone.createDisk('name', config).then(function(data) {
* var disk = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const disk = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -403,3 +413,3 @@ */

var body = extend({}, config, {
name: name
name: name,
});

@@ -427,20 +437,23 @@

this.request({
method: 'POST',
uri: '/disks',
qs: query,
json: body
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/disks',
qs: query,
json: body,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var disk = self.disk(name);
var disk = self.disk(name);
var operation = self.operation(resp.name);
operation.metadata = resp;
var operation = self.operation(resp.name);
operation.metadata = resp;
callback(null, disk, operation, resp);
});
callback(null, disk, operation, resp);
}
);
};

@@ -451,4 +464,4 @@

*
* @resource [InstanceGroup Resource]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups#resource}
* @resource [InstanceGroups: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/insert}
* @see [InstanceGroup Resource]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups#resource}
* @see [InstanceGroups: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/insert}
*

@@ -462,5 +475,5 @@ * @param {string} name - Name of the instance group.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/instance-group} callback.instanceGroup - The created
* @param {InstanceGroup} callback.instanceGroup - The created
* InstanceGroup object.
* @param {module:compute/operation} callback.operation - An operation object
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -470,2 +483,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* function onCreated(err, instanceGroup, operation, apiResponse) {

@@ -484,5 +501,5 @@ * // `instanceGroup` is an InstanceGroup object.

* zone.createInstanceGroup('instance-group-name', config).then(function(data) {
* var instanceGroup = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const instanceGroup = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -499,3 +516,3 @@ */

var body = extend({}, options, {
name: name
name: name,
});

@@ -508,19 +525,22 @@

this.request({
method: 'POST',
uri: '/instanceGroups',
json: body
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/instanceGroups',
json: body,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var instanceGroup = self.instanceGroup(name);
var instanceGroup = self.instanceGroup(name);
var operation = self.operation(resp.name);
operation.metadata = resp;
var operation = self.operation(resp.name);
operation.metadata = resp;
callback(null, instanceGroup, operation, resp);
});
callback(null, instanceGroup, operation, resp);
}
);
};

@@ -531,4 +551,4 @@

*
* @resource [Instance Resource]{@link https://cloud.google.com/compute/docs/reference/v1/instances}
* @resource [Instances: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/insert}
* @see [Instance Resource]{@link https://cloud.google.com/compute/docs/reference/v1/instances}
* @see [Instances: insert API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/insert}
*

@@ -538,7 +558,7 @@ * @param {string} name - Name of the instance.

* [Instance resource](https://cloud.google.com/compute/docs/reference/v1/instances).
* @param {object[]=} config.disks - See a
* @param {?object[]} config.disks - See a
* [Disk resource](https://cloud.google.com/compute/docs/reference/v1/disks).
* @param {boolean=} config.http - Allow HTTP traffic. Default: `false`
* @param {boolean=} config.https - Allow HTTPS traffic. Default: `false`
* @param {object[]=} config.networkInterfaces - An array of configurations for
* @param {?object[]} config.networkInterfaces - An array of configurations for
* this interface. This specifies how this interface should interact with

@@ -554,7 +574,7 @@ * other network services, such as connecting to the internet. Default:

* [this list of accepted OS names](https://github.com/stephenplusplus/gce-images#accepted-os-names).
* @param {string[]=} config.tags - An array of tags.
* @param {?string[]} config.tags - An array of tags.
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/vm} callback.vm - The created VM object.
* @param {module:compute/operation} callback.operation - An operation object
* @param {VM} callback.vm - The created VM object.
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.

@@ -564,2 +584,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* //-

@@ -569,3 +593,3 @@ * // Create a new instance using the latest Debian version from your project

* //-
* var config = {
* const config = {
* os: 'your-project-id-or-name/debian',

@@ -580,3 +604,3 @@ * http: true,

* //-
* var config = {
* const config = {
* os: 'debian',

@@ -591,3 +615,3 @@ * http: true,

* //-
* var config = {
* const config = {
* machineType: 'n1-standard-1',

@@ -632,5 +656,5 @@ * disks: [

* zone.createVM('new-vm-name', config).then(function(data) {
* var vm = data[0];
* var operation = data[1];
* var apiResponse = data[2];
* const vm = data[0];
* const operation = data[1];
* const apiResponse = data[2];
* });

@@ -641,11 +665,14 @@ */

var body = extend({
name: name,
machineType: 'n1-standard-1',
networkInterfaces: [
{
network: 'global/networks/default'
}
]
}, config);
var body = extend(
{
name: name,
machineType: 'n1-standard-1',
networkInterfaces: [
{
network: 'global/networks/default',
},
],
},
config
);

@@ -656,3 +683,3 @@ if (body.machineType.indexOf('/') === -1) {

zoneName: this.name,
machineType: body.machineType
machineType: body.machineType,
});

@@ -663,3 +690,3 @@ }

body.tags = {
items: body.tags
items: body.tags,
};

@@ -676,4 +703,4 @@ }

{
type: 'ONE_TO_ONE_NAT'
}
type: 'ONE_TO_ONE_NAT',
},
];

@@ -730,4 +757,4 @@

initializeParams: {
sourceImage: image.selfLink
}
sourceImage: image.selfLink,
},
});

@@ -741,19 +768,22 @@

this.request({
method: 'POST',
uri: '/instances',
json: body
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
method: 'POST',
uri: '/instances',
json: body,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var vm = self.vm(name);
var vm = self.vm(name);
var operation = self.operation(resp.name);
operation.metadata = resp;
var operation = self.operation(resp.name);
operation.metadata = resp;
callback(null, vm, operation, resp);
});
callback(null, vm, operation, resp);
}
);
};

@@ -764,9 +794,13 @@

*
* @resource [Disks Overview]{@link https://cloud.google.com/compute/docs/disks}
* @see [Disks Overview]{@link https://cloud.google.com/compute/docs/disks}
*
* @param {string} name - Name of the disk.
* @return {module:compute/disk}
* @returns {Disk}
*
* @example
* var disk = zone.disk('disk1');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* const disk = zone.disk('disk1');
*/

@@ -780,5 +814,5 @@ Zone.prototype.disk = function(name) {

*
* @resource [Managing Autoscalers]{@link https://cloud.google.com/compute/docs/autoscaler/managing-autoscalers}
* @resource [Understanding Autoscaler Decisions]{@link https://cloud.google.com/compute/docs/autoscaler/understanding-autoscaler-decisions}
* @resource [Autoscalers: aggregatedList API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers/list}
* @see [Managing Autoscalers]{@link https://cloud.google.com/compute/docs/autoscaler/managing-autoscalers}
* @see [Understanding Autoscaler Decisions]{@link https://cloud.google.com/compute/docs/autoscaler/understanding-autoscaler-decisions}
* @see [Autoscalers: aggregatedList API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/autoscalers/list}
*

@@ -801,3 +835,3 @@ * @param {object=} options - Autoscaler search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/autoscaler[]} callback.autoscalers - Autoscaler
* @param {Autoscaler[]} callback.autoscalers - Autoscaler
* objects from your project.

@@ -807,2 +841,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getAutoscalers(function(err, autoscalers) {

@@ -831,3 +869,3 @@ * // autoscalers is an array of `Autoscaler` objects.

* zone.getAutoscalers().then(function(data) {
* var autoscalers = data[0];
* const autoscalers = data[0];
* });

@@ -845,39 +883,46 @@ */

this.request({
uri: '/autoscalers',
qs: options
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
uri: '/autoscalers',
qs: options,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
var nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken
});
}
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
var autoscalers = arrify(resp.items).map(function(autoscaler) {
var autoscalerInstance = self.autoscaler(autoscaler.name);
autoscalerInstance.metadata = autoscaler;
var autoscalers = arrify(resp.items).map(function(autoscaler) {
var autoscalerInstance = self.autoscaler(autoscaler.name);
autoscalerInstance.metadata = autoscaler;
return autoscalerInstance;
});
return autoscalerInstance;
});
callback(null, autoscalers, nextQuery, resp);
});
callback(null, autoscalers, nextQuery, resp);
}
);
};
/**
* Get a list of {module:compute/autoscaler} objects from this zone as a
* Get a list of {@link Autoscaler} objects from this zone as a
* readable object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/zone#getAutoscalers} for a complete list of options.
* @return {stream}
* {@link Zone#getAutoscalers} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getAutoscalersStream()

@@ -901,4 +946,5 @@ * .on('error', console.error)

*/
Zone.prototype.getAutoscalersStream =
common.paginator.streamify('getAutoscalers');
Zone.prototype.getAutoscalersStream = common.paginator.streamify(
'getAutoscalers'
);

@@ -908,4 +954,4 @@ /**

*
* @resource [Disks Overview]{@link https://cloud.google.com/compute/docs/disks}
* @resource [Disks: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/disks/list}
* @see [Disks Overview]{@link https://cloud.google.com/compute/docs/disks}
* @see [Disks: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/disks/list}
*

@@ -928,6 +974,10 @@ * @param {object=} options - Disk search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/disk[]} callback.disks - Disk objects from this zone.
* @param {Disk[]} callback.disks - Disk objects from this zone.
* @param {object} callback.apiResponse - The full API response.
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getDisks(function(err, disks) {

@@ -956,3 +1006,3 @@ * // `disks` is an array of `Disk` objects.

* zone.getDisks().then(function(data) {
* var disks = data[0];
* const disks = data[0];
* });

@@ -970,38 +1020,45 @@ */

this.request({
uri: '/disks',
qs: options
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
uri: '/disks',
qs: options,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
var nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
var disks = (resp.items || []).map(function(disk) {
var diskInstance = self.disk(disk.name);
diskInstance.metadata = disk;
return diskInstance;
});
callback(null, disks, nextQuery, resp);
}
var disks = (resp.items || []).map(function(disk) {
var diskInstance = self.disk(disk.name);
diskInstance.metadata = disk;
return diskInstance;
});
callback(null, disks, nextQuery, resp);
});
);
};
/**
* Get a list of {module:compute/disk} objects in this zone as a readable object
* Get a list of {@link Disk} objects in this zone as a readable object
* stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/zone#getDisks} for a complete list of options.
* @return {stream}
* {@link Zone#getDisks} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getDisksStream()

@@ -1030,4 +1087,4 @@ * .on('error', console.error)

*
* @resource [InstanceGroups Overview]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups}
* @resource [InstanceGroups: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/list}
* @see [InstanceGroups Overview]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups}
* @see [InstanceGroups: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups/list}
*

@@ -1051,3 +1108,3 @@ * @param {object=} options - Instance group search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/instance-group[]} callback.instanceGroups -
* @param {InstanceGroup[]} callback.instanceGroups -
* InstanceGroup objects from this zone.

@@ -1057,2 +1114,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getInstanceGroups(function(err, instanceGroups) {

@@ -1081,3 +1142,3 @@ * // `instanceGroups` is an array of `InstanceGroup` objects.

* zone.getInstanceGroups().then(function(data) {
* var instanceGroups = data[0];
* const instanceGroups = data[0];
* });

@@ -1095,38 +1156,45 @@ */

this.request({
uri: '/instanceGroups',
qs: options
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
uri: '/instanceGroups',
qs: options,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
var nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
var instanceGroups = (resp.items || []).map(function(instanceGroup) {
var instanceGroupInstance = self.instanceGroup(instanceGroup.name);
instanceGroupInstance.metadata = instanceGroup;
return instanceGroupInstance;
});
callback(null, instanceGroups, nextQuery, resp);
}
var instanceGroups = (resp.items || []).map(function(instanceGroup) {
var instanceGroupInstance = self.instanceGroup(instanceGroup.name);
instanceGroupInstance.metadata = instanceGroup;
return instanceGroupInstance;
});
callback(null, instanceGroups, nextQuery, resp);
});
);
};
/**
* Get a list of {module:compute/instanceGroup} objects for this zone as a
* Get a list of {@link InstanceGroup} objects for this zone as a
* readable object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/zone#getInstanceGroups} for a complete list of options.
* @return {stream}
* {@link Zone#getInstanceGroups} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getInstanceGroupsStream()

@@ -1150,4 +1218,5 @@ * .on('error', console.error)

*/
Zone.prototype.getInstanceGroupsStream =
common.paginator.streamify('getInstanceGroups');
Zone.prototype.getInstanceGroupsStream = common.paginator.streamify(
'getInstanceGroups'
);

@@ -1157,5 +1226,5 @@ /**

*
* @resource [MachineTypes: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes/list}
* @resource [Machine Types Overview]{@link https://cloud.google.com/compute/docs/machine-types}
* @resource [MachineType Resource]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes}
* @see [MachineTypes: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes/list}
* @see [Machine Types Overview]{@link https://cloud.google.com/compute/docs/machine-types}
* @see [MachineType Resource]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes}
*

@@ -1172,3 +1241,3 @@ * @param {object=} options - Machine type search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/machine-type[]} callback.machineTypes - MachineType
* @param {MachineType[]} callback.machineTypes - MachineType
* objects from this zone.

@@ -1178,2 +1247,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getMachineTypes(function(err, machineTypes) {

@@ -1202,3 +1275,3 @@ * // `machineTypes` is an array of `MachineType` objects.

* zone.getMachineTypes().then(function(data) {
* var machineTypes = data[0];
* const machineTypes = data[0];
* });

@@ -1213,3 +1286,3 @@ */

options = extend({}, options, {
filter: 'zone eq .*' + this.name
filter: 'zone eq .*' + this.name,
});

@@ -1221,10 +1294,14 @@

/**
* Get a list of {module:compute/machineType} objects for this zone as a
* Get a list of {@link MachineType} objects for this zone as a
* readable object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/zone#getMachineTypes} for a complete list of options.
* @return {stream}
* {@link Zone#getMachineTypes} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getMachineTypesStream()

@@ -1248,4 +1325,5 @@ * .on('error', console.error)

*/
Zone.prototype.getMachineTypesStream =
common.paginator.streamify('getMachineTypes');
Zone.prototype.getMachineTypesStream = common.paginator.streamify(
'getMachineTypes'
);

@@ -1255,4 +1333,4 @@ /**

*
* @resource [Zone Operation Overview]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations}
* @resource [ZoneOperations: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations/list}
* @see [Zone Operation Overview]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations}
* @see [ZoneOperations: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations/list}
*

@@ -1275,3 +1353,3 @@ * @param {object=} options - Operation search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/operation[]} callback.operations - Operation objects
* @param {Operation[]} callback.operations - Operation objects
* from this zone.

@@ -1281,2 +1359,6 @@ * @param {object} callback.apiResponse - The full API response.

* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getOperations(function(err, operations) {

@@ -1305,3 +1387,3 @@ * // `operations` is an array of `Operation` objects.

* zone.getOperations().then(function(data) {
* var operations = data[0];
* const operations = data[0];
* });

@@ -1319,38 +1401,45 @@ */

this.request({
uri: '/operations',
qs: options
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
uri: '/operations',
qs: options,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
var nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
var operations = (resp.items || []).map(function(operation) {
var operationInstance = self.operation(operation.name);
operationInstance.metadata = operation;
return operationInstance;
});
callback(null, operations, nextQuery, resp);
}
var operations = (resp.items || []).map(function(operation) {
var operationInstance = self.operation(operation.name);
operationInstance.metadata = operation;
return operationInstance;
});
callback(null, operations, nextQuery, resp);
});
);
};
/**
* Get a list of {module:compute/operation} objects for this zone as a readable
* Get a list of {@link Operation} objects for this zone as a readable
* object stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/zone#getOperations} for a complete list of options.
* @return {stream}
* {@link Zone#getOperations} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getOperationsStream()

@@ -1374,4 +1463,5 @@ * .on('error', console.error)

*/
Zone.prototype.getOperationsStream =
common.paginator.streamify('getOperations');
Zone.prototype.getOperationsStream = common.paginator.streamify(
'getOperations'
);

@@ -1381,4 +1471,4 @@ /**

*
* @resource [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @resource [Instances: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/list}
* @see [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @see [Instances: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instances/list}
*

@@ -1399,6 +1489,10 @@ * @param {object=} options - Instance search options.

* @param {?error} callback.err - An error returned while making this request.
* @param {module:compute/vm[]} callback.vms - VM objects from this zone.
* @param {VM[]} callback.vms - VM objects from this zone.
* @param {object} callback.apiResponse - The full API response.
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getVMs(function(err, vms) {

@@ -1412,3 +1506,3 @@ * // `vms` is an array of `VM` objects.

* //-
* function callback(err, vms, nextQuery, apiResponse) {
* function callback(err, vms, nextQuery, apiResponse) {
* if (nextQuery) {

@@ -1428,3 +1522,3 @@ * // More results exist.

* zone.getVMs().then(function(data) {
* var vms = data[0];
* const vms = data[0];
* });

@@ -1442,38 +1536,45 @@ */

this.request({
uri: '/instances',
qs: options
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
this.request(
{
uri: '/instances',
qs: options,
},
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
var nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
var vms = (resp.items || []).map(function(instance) {
var vmInstance = self.vm(instance.name);
vmInstance.metadata = instance;
return vmInstance;
});
callback(null, vms, nextQuery, resp);
}
var vms = (resp.items || []).map(function(instance) {
var vmInstance = self.vm(instance.name);
vmInstance.metadata = instance;
return vmInstance;
});
callback(null, vms, nextQuery, resp);
});
);
};
/**
* Get a list of {module:compute/vm} instances in this zone as a readable object
* Get a list of {@link VM} instances in this zone as a readable object
* stream.
*
* @param {object=} options - Configuration object. See
* {module:compute/zone#getVMs} for a complete list of options.
* @return {stream}
* {@link Zone#getVMs} for a complete list of options.
* @returns {stream}
*
* @example
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* zone.getVMsStream()

@@ -1502,9 +1603,13 @@ * .on('error', console.error)

*
* @resource [InstanceGroups Overview]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups}
* @see [InstanceGroups Overview]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroups}
*
* @param {string} name - Name of the existing instance group.
* @return {module:compute/instance-group}
* @returns {InstanceGroup}
*
* @example
* var instanceGroup = zone.instanceGroup('my-instance-group');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* const instanceGroup = zone.instanceGroup('my-instance-group');
*/

@@ -1518,10 +1623,14 @@ Zone.prototype.instanceGroup = function(name) {

*
* @resource [Machine Types Overview]{@link https://cloud.google.com/compute/docs/machine-types}
* @resource [MachineType Resource]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes}
* @see [Machine Types Overview]{@link https://cloud.google.com/compute/docs/machine-types}
* @see [MachineType Resource]{@link https://cloud.google.com/compute/docs/reference/v1/machineTypes}
*
* @param {string} name - Name of the existing machine type.
* @return {module:compute/machine-type}
* @returns {MachineType}
*
* @example
* var machienType = zone.machineType('g1-small');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* const machineType = zone.machineType('g1-small');
*/

@@ -1535,9 +1644,13 @@ Zone.prototype.machineType = function(name) {

*
* @resource [Zone Operation Overview]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations}
* @see [Zone Operation Overview]{@link https://cloud.google.com/compute/docs/reference/v1/zoneOperations}
*
* @param {string} name - Name of the existing operation.
* @return {module:compute/operation}
* @returns {Operation}
*
* @example
* var operation = zone.operation('operation-1445532685163-8b137d2a-1822afe7');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* const operation = zone.operation('operation-1445532685163-8b137d2a-1822afe7');
*/

@@ -1551,9 +1664,13 @@ Zone.prototype.operation = function(name) {

*
* @resource [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
* @see [Instances and Networks]{@link https://cloud.google.com/compute/docs/instances-and-network}
*
* @param {string} name - Name of the virtual machine.
* @return {module:compute/vm}
* @returns {VM}
*
* @example
* var vm = zone.vm('vm-name');
* const Compute = require('@google-cloud/compute');
* const compute = new Compute();
* const zone = compute.zone('us-central1-a');
*
* const vm = zone.vm('vm-name');
*/

@@ -1574,12 +1691,16 @@ Zone.prototype.vm = function(name) {

Zone.prototype.createHttpServerFirewall_ = function(callback) {
this.compute.createFirewall('default-allow-http', {
protocols: {
tcp: [80]
this.compute.createFirewall(
'default-allow-http',
{
protocols: {
tcp: [80],
},
ranges: ['0.0.0.0/0'],
tags: ['http-server'],
},
ranges: ['0.0.0.0/0'],
tags: ['http-server']
}, function(err) {
// If it already exists, we're all good.
callback(err && err.code !== 409 ? err : null);
});
function(err) {
// If it already exists, we're all good.
callback(err && err.code !== 409 ? err : null);
}
);
};

@@ -1597,12 +1718,16 @@

Zone.prototype.createHttpsServerFirewall_ = function(callback) {
this.compute.createFirewall('default-allow-https', {
protocols: {
tcp: [443]
this.compute.createFirewall(
'default-allow-https',
{
protocols: {
tcp: [443],
},
ranges: ['0.0.0.0/0'],
tags: ['https-server'],
},
ranges: ['0.0.0.0/0'],
tags: ['https-server']
}, function(err) {
// If it already exists, we're all good.
callback(err && err.code !== 409 ? err : null);
});
function(err) {
// If it already exists, we're all good.
callback(err && err.code !== 409 ? err : null);
}
);
};

@@ -1620,3 +1745,3 @@

'getOperations',
'getVMs'
'getVMs',
]);

@@ -1636,6 +1761,11 @@

'operation',
'vm'
]
'vm',
],
});
/**
* Reference to the {@link Zone} class.
* @name module:@google-cloud/compute.Zone
* @see Zone
*/
module.exports = Zone;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc