-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce auto-generated Gapic client for monitoring API #1657
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
542742e
Introduce auto-generated Gapic client for monitoring API
landrito dfa329f
Revisions as per review.
landrito c825ff8
Regenerated per toolkit revisions
landrito 7402338
add tests & docs
stephenplusplus 48e7cec
update deps
stephenplusplus 94b54db
add Monitoring to config
stephenplusplus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.