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
1
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.12.0 to 1.0.0

29

CHANGELOG.md

@@ -7,2 +7,30 @@ # Changelog

## [1.0.0](https://www.github.com/googleapis/nodejs-compute/compare/v0.12.0...v1.0.0) (2019-05-20)
### ⚠ BREAKING CHANGES
* upgrade engines field to >=8.10.0 (#292)
### Bug Fixes
* **deps:** update dependency @google-cloud/common to ^0.32.0 ([#285](https://www.github.com/googleapis/nodejs-compute/issues/285)) ([a728cff](https://www.github.com/googleapis/nodejs-compute/commit/a728cff))
* **deps:** update dependency @google-cloud/common to v1 ([#303](https://www.github.com/googleapis/nodejs-compute/issues/303)) ([5b5e2e7](https://www.github.com/googleapis/nodejs-compute/commit/5b5e2e7))
* **deps:** update dependency @google-cloud/paginator to v1 ([#297](https://www.github.com/googleapis/nodejs-compute/issues/297)) ([16b5ff2](https://www.github.com/googleapis/nodejs-compute/commit/16b5ff2))
* **deps:** update dependency @google-cloud/projectify to v1 ([#295](https://www.github.com/googleapis/nodejs-compute/issues/295)) ([30fff7d](https://www.github.com/googleapis/nodejs-compute/commit/30fff7d))
* **deps:** update dependency @google-cloud/promisify to v1 ([#296](https://www.github.com/googleapis/nodejs-compute/issues/296)) ([166e99e](https://www.github.com/googleapis/nodejs-compute/commit/166e99e))
* **deps:** update dependency arrify to v2 ([#287](https://www.github.com/googleapis/nodejs-compute/issues/287)) ([4bc19c8](https://www.github.com/googleapis/nodejs-compute/commit/4bc19c8))
* **deps:** update dependency gce-images to v2 ([#304](https://www.github.com/googleapis/nodejs-compute/issues/304)) ([19eaaf5](https://www.github.com/googleapis/nodejs-compute/commit/19eaaf5))
* **deps:** update dependency nodemailer to v6 ([4c8e9c5](https://www.github.com/googleapis/nodejs-compute/commit/4c8e9c5))
### Build System
* upgrade engines field to >=8.10.0 ([#292](https://www.github.com/googleapis/nodejs-compute/issues/292)) ([4101d77](https://www.github.com/googleapis/nodejs-compute/commit/4101d77))
### Features
* Adds abandonInstances to InstanceGroupManger API ([#306](https://www.github.com/googleapis/nodejs-compute/issues/306)) ([c359ce3](https://www.github.com/googleapis/nodejs-compute/commit/c359ce3))
## v0.12.0

@@ -173,2 +201,1 @@

- Upgrade repo-tools and regenerate scaffolding. ([#55](https://github.com/googleapis/nodejs-compute/pull/55))

25

package.json
{
"name": "@google-cloud/compute",
"description": "Google Compute Engine Client Library for Node.js",
"version": "0.12.0",
"version": "1.0.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
"node": ">=6.0.0"
"node": ">=8.10.0"
},

@@ -39,14 +39,13 @@ "repository": "googleapis/nodejs-compute",

"dependencies": {
"@google-cloud/common": "^0.31.0",
"@google-cloud/paginator": "^0.2.0",
"@google-cloud/projectify": "^0.3.0",
"@google-cloud/promisify": "^0.4.0",
"arrify": "^1.0.1",
"@google-cloud/common": "^1.0.0",
"@google-cloud/paginator": "^1.0.0",
"@google-cloud/projectify": "^1.0.0",
"@google-cloud/promisify": "^1.0.0",
"arrify": "^2.0.0",
"async": "^2.6.1",
"create-error-class": "^3.0.2",
"extend": "^3.0.1",
"gce-images": "^1.0.0",
"gce-images": "^2.0.0",
"is": "^3.2.1",
"string-format-obj": "^1.1.1",
"teeny-request": "^3.10.0"
"string-format-obj": "^1.1.1"
},

@@ -59,9 +58,9 @@ "devDependencies": {

"eslint-config-prettier": "^4.0.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-node": "^9.0.0",
"eslint-plugin-prettier": "^3.0.0",
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",
"intelli-espower-loader": "^1.0.1",
"jsdoc": "^3.5.5",
"jsdoc": "^3.6.2",
"mocha": "^6.0.0",
"nyc": "^13.0.0",
"nyc": "^14.0.0",
"power-assert": "^1.5.0",

@@ -68,0 +67,0 @@ "prettier": "^1.13.5",

[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `npm run generate-scaffolding`."
[//]: # "To regenerate it, use `python -m synthtool`."
<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"/>

@@ -7,14 +7,15 @@

[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style&#x3D;flat)](https://cloud.google.com/terms/launch-stages)
[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
[![npm version](https://img.shields.io/npm/v/@google-cloud/compute.svg)](https://www.npmjs.org/package/@google-cloud/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].
[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.
* [Compute Engine Node.js Client API Reference][client-docs]
Google Compute Engine Client Library for Node.js
* [Google Compute Engine Node.js Client API Reference][client-docs]
* [Google Compute Engine Documentation][product-docs]
* [github.com/googleapis/nodejs-compute](https://github.com/googleapis/nodejs-compute)
* [Compute Engine Documentation][product-docs]

@@ -28,2 +29,3 @@ Read more about the client libraries for Cloud APIs, including the older

* [Quickstart](#quickstart)

@@ -42,55 +44,47 @@ * [Before you begin](#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. [Select or create a Cloud Platform project][projects].
1. [Enable billing for your project][billing].
1. [Enable the Google Compute Engine 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
```bash
npm install @google-cloud/compute
```
### Using the client library
```javascript
// Imports the Google Cloud client library
const Compute = require('@google-cloud/compute');
// Imports the Google Cloud client library
const Compute = require('@google-cloud/compute');
// Creates a client
const compute = new 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';
async function quickstart() {
// Create a new VM using the latest OS image of your choice.
const zone = compute.zone('us-central1-c');
zone
.createVM(name, {os: 'ubuntu'})
.then(data => {
// TODO(developer): choose a name for the VM
// const vmName = 'vm-name';
// Start the VM create task
const [vm, operation] = await zone.createVM(vmName, {os: 'ubuntu'});
console.log(vm);
// `operation` lets you check the status of long-running tasks.
const vm = data[0];
const operation = data[1];
return operation.promise();
})
.then(() => {
// Virtual machine created!
})
.catch(err => {
console.error('ERROR:', err);
});
await operation.promise();
// Complete!
console.log('Virtual machine created!');
}
quickstart();
```
## Samples

@@ -103,6 +97,14 @@

| --------------------------- | --------------------------------- | ------ |
| Create Virtual Machine with Apache and Custom Homepage | [source code](https://github.com/googleapis/nodejs-compute/blob/master/samples/startupScript.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/startupScript.js,samples/README.md) |
| List 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) |
| Create VM | [source code](https://github.com/googleapis/nodejs-compute/blob/master/samples/createVM.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/createVM.js,samples/README.md) |
| Delete VM | [source code](https://github.com/googleapis/nodejs-compute/blob/master/samples/deleteVM.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/deleteVM.js,samples/README.md) |
| List VMs | [source code](https://github.com/googleapis/nodejs-compute/blob/master/samples/listVMs.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/listVMs.js,samples/README.md) |
| Mailjet | [source code](https://github.com/googleapis/nodejs-compute/blob/master/samples/mailjet.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/mailjet.js,samples/README.md) |
| Quickstart | [source code](https://github.com/googleapis/nodejs-compute/blob/master/samples/quickstart.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/quickstart.js,samples/README.md) |
| Sendgrid | [source code](https://github.com/googleapis/nodejs-compute/blob/master/samples/sendgrid.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/sendgrid.js,samples/README.md) |
| Startup Script | [source code](https://github.com/googleapis/nodejs-compute/blob/master/samples/startupScript.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/startupScript.js,samples/README.md) |
| Vms | [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) |
The [Compute Engine Node.js Client API Reference][client-docs] documentation
The [Google Compute Engine Node.js Client API Reference][client-docs] documentation
also contains samples.

@@ -114,2 +116,5 @@

This library is considered to be in **alpha**. This means it is still a

@@ -119,2 +124,4 @@ work-in-progress and under active development. Any release is subject to

More Information: [Google Cloud Platform Launch Stages][launch_stages]

@@ -135,4 +142,7 @@

[client-docs]: https://cloud.google.com/nodejs/docs/reference/compute/latest/
[product-docs]: https://cloud.google.com/compute/docs/
[product-docs]: https://cloud.google.com/compute
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[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

@@ -21,3 +21,2 @@ /*!

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

@@ -167,3 +166,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -170,0 +168,0 @@ /**

@@ -21,3 +21,2 @@ /*!

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

@@ -182,3 +181,2 @@ /*! Developer Documentation

methods: methods,
requestModule: teenyRequest,
});

@@ -185,0 +183,0 @@ /**

@@ -23,3 +23,2 @@ /*!

const {promisifyAll} = require('@google-cloud/promisify');
const {teenyRequest} = require('teeny-request');
const Snapshot = require('./snapshot.js');

@@ -177,3 +176,2 @@

methods: methods,
requestModule: teenyRequest,
});

@@ -180,0 +178,0 @@ /**

@@ -21,3 +21,2 @@ /*!

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

@@ -170,3 +169,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -173,0 +171,0 @@ /**

@@ -23,3 +23,2 @@ /*!

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

@@ -186,3 +185,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -189,0 +187,0 @@ /**

@@ -21,3 +21,2 @@ /*!

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

@@ -161,3 +160,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -164,0 +162,0 @@ }

@@ -23,3 +23,2 @@ /*!

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

@@ -145,3 +144,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -161,2 +159,57 @@ /**

/**
* Flags the specified instances to be removed from the managed instance group.
* @see [InstanceGroupManagers: abandonInstances API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroupManagers/abandonInstances}
* @param {VM|VM[]} vms - VM instances to abandon from
* this instance group manager.
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {Operation} callback.operation - An operation object
* that can be used to check the status of the request.
* @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 instanceGroupManager = zone.instanceGroupManager('web-servers');
*
* const vms = [
* gce.zone('us-central1-a').vm('http-server'),
* gce.zone('us-central1-a').vm('https-server')
* ];
*
* instanceGroupManager.abandonInstances(vms, function(err, operation, apiResponse) {
* // `operation` is an Operation object that can be used to check the status
* // of the request.
* });
*
* //-
* // If the callback is omitted, we'll return a Promise.
* //-
* instanceGroupManager.abandonInstances(vms).then(function(data) {
* const operation = data[0];
* const apiResponse = data[1];
* });
*/
abandonInstances(vms, callback) {
this.request(
{
method: 'POST',
uri: '/abandonInstances',
json: {
instances: arrify(vms).map(vm => vm.url),
},
},
(err, resp) => {
if (err) {
callback(err, null, resp);
return;
}
const operation = this.zone.operation(resp.name);
operation.metadata = resp;
callback(null, operation, resp);
}
);
}
/**
* Flags the specified instances in the managed instance group for immediate deletion.

@@ -197,3 +250,2 @@ * @see [InstanceGroupManagers: deleteInstances API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/instanceGroupManagers/deleteInstances}

deleteInstances(vms, callback) {
const self = this;
this.request(

@@ -204,8 +256,6 @@ {

json: {
instances: arrify(vms).map(function(vm) {
return vm.url;
}),
instances: arrify(vms).map(vm => vm.url),
},
},
function(err, resp) {
(err, resp) => {
if (err) {

@@ -215,3 +265,3 @@ callback(err, null, resp);

}
const operation = self.zone.operation(resp.name);
const operation = this.zone.operation(resp.name);
operation.metadata = resp;

@@ -280,3 +330,2 @@ callback(null, operation, resp);

getManagedInstances(options, callback) {
const self = this;
if (is.fn(options)) {

@@ -293,3 +342,3 @@ callback = options;

},
function(err, resp) {
(err, resp) => {
if (err) {

@@ -305,4 +354,4 @@ callback(err, null, null, resp);

}
const vms = arrify(resp.managedInstances).map(function(vm) {
const vmInstance = self.zone.vm(vm.instance);
const vms = arrify(resp.managedInstances).map(vm => {
const vmInstance = this.zone.vm(vm.instance);
vmInstance.metadata = vm;

@@ -347,3 +396,2 @@ return vmInstance;

resize(size, callback) {
const self = this;
this.request(

@@ -355,3 +403,3 @@ {

},
function(err, resp) {
(err, resp) => {
if (err) {

@@ -361,3 +409,3 @@ callback(err, null, resp);

}
const operation = self.zone.operation(resp.name);
const operation = this.zone.operation(resp.name);
operation.metadata = resp;

@@ -364,0 +412,0 @@ callback(null, operation, resp);

@@ -24,3 +24,2 @@ /*!

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

@@ -177,3 +176,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -180,0 +178,0 @@ /**

@@ -20,3 +20,2 @@ /*!

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

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

methods: methods,
requestModule: teenyRequest,
});

@@ -136,0 +134,0 @@ /**

@@ -23,3 +23,2 @@ /*!

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

@@ -172,3 +171,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -175,0 +173,0 @@ /**

@@ -21,3 +21,2 @@ /*!

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

@@ -179,3 +178,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -182,0 +180,0 @@

@@ -21,3 +21,2 @@ /*!

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

@@ -100,3 +99,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -103,0 +101,0 @@ }

@@ -23,3 +23,2 @@ /*!

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

@@ -136,3 +135,2 @@ const Address = require('./address.js');

methods: methods,
requestModule: teenyRequest,
});

@@ -139,0 +137,0 @@ /**

@@ -21,3 +21,2 @@ /*!

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

@@ -191,3 +190,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -194,0 +192,0 @@ /**

@@ -24,3 +24,2 @@ /*!

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

@@ -186,3 +185,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -189,0 +187,0 @@ /**

@@ -21,3 +21,2 @@ /*!

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

@@ -139,3 +138,2 @@ /**

methods: methods,
requestModule: teenyRequest,
};

@@ -142,0 +140,0 @@ if (isDisk) {

@@ -21,3 +21,2 @@ /*!

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

@@ -173,3 +172,2 @@ /**

methods: methods,
requestModule: teenyRequest,
});

@@ -176,0 +174,0 @@ /**

@@ -25,3 +25,2 @@ /*!

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

@@ -229,3 +228,2 @@ const Disk = require('./disk.js');

methods: methods,
requestModule: teenyRequest,
});

@@ -232,0 +230,0 @@

@@ -28,3 +28,2 @@ /*!

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

@@ -143,3 +142,2 @@ const Autoscaler = require('./autoscaler.js');

methods: methods,
requestModule: teenyRequest,
});

@@ -146,0 +144,0 @@ /**

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