Skip to content

Commit fb463df

Browse files
stephenpluspluscallmehiphop
authored andcommitted
add readmes for all packages (#1495)
* add bigquery readme * add all readmes * copy readme as part of release script * gcloud-node -> google-cloud-node * fix youre good to gos * add resource manager scope * exclude unecessary files
1 parent 5f68116 commit fb463df

2 files changed

Lines changed: 90 additions & 1 deletion

File tree

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# @google-cloud/resource
2+
> Google Cloud Resource Manager Client Library for Node.js
3+
4+
> **This is a Beta release of Google Cloud Resource Manager.** This feature is not covered by any SLA or deprecation policy and may be subject to backward-incompatible changes.
5+
6+
*Looking for more Google APIs than just Resource Manager? You might want to check out [`google-cloud`][google-cloud].*
7+
8+
- [API Documentation][gcloud-resource-docs]
9+
- [Official Documentation][cloud-resource-docs]
10+
11+
12+
```sh
13+
$ npm install --save @google-cloud/resource
14+
```
15+
```js
16+
var resource = require('@google-cloud/resource')({
17+
projectId: 'grape-spaceship-123',
18+
keyFilename: '/path/to/keyfile.json'
19+
});
20+
21+
// Get all of the projects you maintain.
22+
resource.getProjects(function(err, projects) {
23+
if (!err) {
24+
// `projects` contains all of your projects.
25+
}
26+
});
27+
28+
// Get the metadata from your project. (defaults to `grape-spaceship-123`)
29+
var project = resource.project();
30+
31+
project.getMetadata(function(err, metadata) {
32+
// `metadata` describes your project.
33+
});
34+
```
35+
36+
37+
## Authentication
38+
39+
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 Google Cloud services.
40+
41+
### On Google Compute Engine
42+
43+
If you are running this client on Google Compute Engine, 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.
44+
45+
``` js
46+
// Authenticating on a global basis.
47+
var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123'
48+
49+
var resource = require('@google-cloud/resource')({
50+
projectId: projectId
51+
});
52+
53+
// ...you're good to go!
54+
```
55+
56+
### Elsewhere
57+
58+
If you are not running this client on Google Compute Engine, you need a Google Developers service account. To create a service account:
59+
60+
1. Visit the [Google Developers Console][dev-console].
61+
2. Create a new project or click on an existing project.
62+
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):
63+
* Google Cloud Resource Manager API
64+
4. Navigate to **APIs & auth** > **Credentials** and then:
65+
* If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests.
66+
* If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file.
67+
68+
``` js
69+
var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123'
70+
71+
var resource = require('@google-cloud/resource')({
72+
projectId: projectId,
73+
74+
// The path to your key file:
75+
keyFilename: '/path/to/keyfile.json'
76+
77+
// Or the contents of the key file:
78+
credentials: require('./path/to/keyfile.json')
79+
});
80+
81+
// ...you're good to go!
82+
```
83+
84+
85+
[google-cloud]: https://github.com/GoogleCloudPlatform/google-cloud-node/
86+
[gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
87+
[dev-console]: https://console.developers.google.com/project
88+
[gcloud-resource-docs]: https://googlecloudplatform.github.io/google-cloud-node/#/docs/resource
89+
[cloud-resource-docs]: https://cloud.google.com/resource-manager

packages/google-cloud-resourcemanager/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@google-cloud/resource",
33
"version": "0.1.1",
44
"author": "Google Inc.",
5-
"description": "Google Cloud Resource Client Library for Node.js",
5+
"description": "Google Cloud Resource Manager Client Library for Node.js",
66
"contributors": [
77
{
88
"name": "Burcu Dogan",

0 commit comments

Comments
 (0)