-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce auto-generated Gapic client for monitoring API (#1657)
- Loading branch information
1 parent
dde7f07
commit f5f09ad
Showing
10 changed files
with
1,833 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# @google-cloud/monitoring | ||
> Stackdriver Monitoring Client Library for Node.js | ||
*Looking for more Google APIs than just Monitoring? You might want to check out [`google-cloud`][google-cloud].* | ||
|
||
- [Official Documentation][cloud-monitoring-docs] | ||
|
||
## This is an auto-generated API | ||
|
||
It does not follow the conventions you're familiar with from other parts of our library. A handwritten layer is not yet available. | ||
|
||
The example below shows you how to instantiate the generated client. For further documentation, please browse the [Monitoring .proto files][cloud-monitoring-protos] on GitHub. | ||
|
||
|
||
```sh | ||
$ npm install --save @google-cloud/monitoring | ||
``` | ||
```js | ||
var monitoring = require('@google-cloud/monitoring').v3({ | ||
projectId: 'grape-spaceship-123', | ||
keyFilename: '/path/to/keyfile.json' | ||
}); | ||
``` | ||
|
||
|
||
## Authentication | ||
|
||
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. | ||
|
||
### On Google Compute Engine | ||
|
||
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. | ||
|
||
``` js | ||
// Authenticating on a global basis. | ||
var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' | ||
|
||
var monitoring = require('@google-cloud/monitoring').v3({ | ||
projectId: projectId | ||
}); | ||
|
||
// ...you're good to go! | ||
``` | ||
|
||
### Elsewhere | ||
|
||
If you are not running this client on Google Compute Engine, you need a Google Developers service account. To create a service account: | ||
|
||
1. Visit the [Google Developers Console][dev-console]. | ||
2. Create a new project or click on an existing project. | ||
3. Navigate to **APIs & auth** > **Credentials** and then: | ||
* 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. | ||
* 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. | ||
|
||
``` js | ||
var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' | ||
|
||
var monitoring = require('@google-cloud/monitoring')({ | ||
projectId: projectId, | ||
|
||
// The path to your key file: | ||
keyFilename: '/path/to/keyfile.json' | ||
|
||
// Or the contents of the key file: | ||
credentials: require('./path/to/keyfile.json') | ||
}); | ||
|
||
// ...you're good to go! | ||
``` | ||
|
||
[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 | ||
[cloud-monitoring-docs]: https://cloud.google.com/monitoring/docs | ||
[cloud-monitoring-protos]: https://github.com/googleapis/googleapis/tree/master/google/monitoring/v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"repository": "googlecloudplatform/google-cloud-node", | ||
"name": "@google-cloud/monitoring", | ||
"version": "0.0.0", | ||
"author": "Google Inc.", | ||
"description": "Stackdriver Monitoring 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" | ||
} | ||
], | ||
"main": "src/index.js", | ||
"files": [ | ||
"src", | ||
"AUTHORS", | ||
"CONTRIBUTING", | ||
"COPYING" | ||
], | ||
"keywords": [ | ||
"google apis client", | ||
"google api client", | ||
"google apis", | ||
"google api", | ||
"google", | ||
"google cloud platform", | ||
"google cloud", | ||
"cloud", | ||
"google monitoring", | ||
"monitoring", | ||
"stackdriver monitoring", | ||
"stackdriver" | ||
], | ||
"dependencies": { | ||
"google-gax": "^0.7.0", | ||
"google-proto-files": "^0.8.3", | ||
"extend": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^3.1.2" | ||
}, | ||
"scripts": { | ||
"publish-module": "node ../../scripts/publish.js monitoring", | ||
"test": "mocha test/*.js" | ||
}, | ||
"license": "Apache-2.0", | ||
"engines": { | ||
"node": ">=0.12.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*! | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/*! | ||
* @module monitoring | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/** | ||
* <p class="notice"> | ||
* **This is a Beta release of Stackdriver Monitoring.** This API is not | ||
* covered by any SLA or deprecation policy and may be subject to | ||
* backward-incompatible changes. | ||
* </p> | ||
* | ||
* [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs) collects | ||
* metrics, events, and metadata from Google Cloud Platform, Amazon Web Services | ||
* (AWS), hosted uptime probes, application instrumentation, and a variety of | ||
* common application components including Cassandra, Nginx, Apache Web Server, | ||
* Elasticsearch and many others. Stackdriver ingests that data and generates | ||
* insights via dashboards, charts, and alerts. | ||
* | ||
* <h2>This is an auto-generated API</h2> | ||
* | ||
* It does not follow the conventions you're familiar with from other parts of | ||
* our library. A handwritten layer is not yet available. | ||
* | ||
* The example below shows you how to instantiate the generated client. For | ||
* further documentation, please browse the | ||
* [Monitoring .proto files](https://github.com/googleapis/googleapis/tree/master/google/monitoring/v3) | ||
* on GitHub. | ||
* | ||
* @constructor | ||
* @alias module:monitoring | ||
*/ | ||
function Monitoring() { | ||
throw new Error([ | ||
'Cloud Monitoring must be accessed through the auto-generated client.', | ||
'See', | ||
'https://googlecloudplatform.github.io/google-cloud-node/#/docs/monitoring', | ||
'for more information.' | ||
].join(' ')); | ||
} | ||
|
||
module.exports = Monitoring; | ||
module.exports.v3 = require('./v3'); |
Oops, something went wrong.