Skip to content

Commit

Permalink
docs: use repo-metadata to generate README (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Apr 30, 2019
1 parent 765c42b commit 53b7fa0
Show file tree
Hide file tree
Showing 7 changed files with 234 additions and 104 deletions.
23 changes: 0 additions & 23 deletions packages/google-cloud-compute/.cloud-repo-tools.json

This file was deleted.

3 changes: 1 addition & 2 deletions packages/google-cloud-compute/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ system-test/secrets.js
system-test/*key.json
*.lock
.DS_Store
google-cloud-logging-winston-*.tgz
google-cloud-logging-bunyan-*.tgz
__pycache__
.vscode
package-lock.json
13 changes: 13 additions & 0 deletions packages/google-cloud-compute/.repo-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "compute",
"name_pretty": "Google Compute Engine",
"product_documentation": "https://cloud.google.com/compute",
"client_documentation": "https://cloud.google.com/nodejs/docs/reference/compute/latest/",
"issue_tracker": "https://issuetracker.google.com/savedsearches/559755",
"release_level": "alpha",
"language": "nodejs",
"repo": "googleapis/nodejs-compute",
"distribution_name": "@google-cloud/compute",
"api_id": "compute.googleapis.com",
"requires_billing": true
}
108 changes: 59 additions & 49 deletions packages/google-cloud-compute/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[//]: # "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"/>

# [Google Compute Engine: Node.js Client](https://github.com/googleapis/nodejs-compute)

[![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]

Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in [Client Libraries Explained][explained].
Expand All @@ -24,6 +25,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].

**Table of contents:**


* [Quickstart](#quickstart)
* [Before you begin](#before-you-begin)
* [Installing the client library](#installing-the-client-library)
Expand All @@ -37,80 +39,85 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].

### 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();
async function quickstart() {
// Create a new VM using the latest OS image of your choice.
const zone = compute.zone('us-central1-c');

// Create a new VM using the latest OS image of your choice.
const zone = compute.zone('us-central1-a');
const name = 'ubuntu-http';
// 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);

zone
.createVM(name, {os: 'ubuntu'})
.then(data => {
// `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

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.

| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| 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.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).




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.



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

[launch_stages]: https://cloud.google.com/terms/launch-stages
Expand All @@ -126,6 +133,9 @@ Apache Version 2.0
See [LICENSE](https://github.com/googleapis/nodejs-compute/blob/master/LICENSE)

[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
Loading

0 comments on commit 53b7fa0

Please sign in to comment.