Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Nodejs GAPIC: Monitoring v3 #391

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 0 additions & 201 deletions generated/nodejs/monitoring/LICENSE

This file was deleted.

120 changes: 75 additions & 45 deletions generated/nodejs/monitoring/README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,75 @@
Stackdriver Monitoring API for Node.js
=================================================

@google-cloud/monitoring uses [Google API extensions][google-gax] to provide an
easy-to-use client library for the [Stackdriver Monitoring API][] (v3) defined in the [googleapis][] git repository


[googleapis]: https://github.com/googleapis/googleapis/tree/master/google/google/monitoring/v3
[google-gax]: https://github.com/googleapis/gax-nodejs
[Stackdriver Monitoring API]: https://developers.google.com/apis-explorer/#p/monitoring/v3/

Getting started
---------------

@google-cloud/monitoring will allow you to connect to the [Stackdriver Monitoring API][] and access all its methods.

In order to do so, you need to set up authentication as well as install the library locally.


Setup Authentication
--------------------

To authenticate all your API calls, first install and setup the [Google Cloud SDK][].
Once done, you can then run the following command in your terminal:

$ gcloud beta auth application-default login

or

$ gcloud auth login

Please see [[gcloud beta auth application-default login][] document for the difference between these commands.

[Google Cloud SDK]: https://cloud.google.com/sdk/
[gcloud beta auth application-default login]: https://cloud.google.com/sdk/gcloud/reference/beta/auth/application-default/login


Installation
-------------------

Install this library using npm:

$ npm install @google-cloud/monitoring

At this point you are all set to continue.
# Node.js Clients for Stackdriver Monitoring API ([Beta](https://github.com/GoogleCloudPlatform/google-cloud-node#versioning))

[Stackdriver Monitoring API][Product Documentation]: Manages your Stackdriver Monitoring data and configurations. Most projects must be associated with a Stackdriver account, with a few exceptions as noted on the individual method pages.

- [Client Library Documentation][]
- [Product Documentation][]

## Quick Start
In order to use this library, you first need to go through the following steps:

1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
2. [Enable the Stackdriver Monitoring API.](https://console.cloud.google.com/apis/api/monitoring)
3. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-node/#/docs/google-cloud/master/guides/authentication)

### Installation
```
$ npm install --save @google-cloud/monitoring
```

### Preview
#### MetricServiceClient
```js
var monitoring = require('@google-cloud/monitoring');

var client = monitoring.metric({
// optional auth parameters.
});

// Iterate over all elements.
var formattedName = client.projectPath(projectId);

client.listMonitoredResourceDescriptors({name: formattedName}).then(function(responses) {
var resources = responses[0];
for (var i = 0; i < resources.length; ++i) {
// doThingsWith(resources[i])
}
})
.catch(function(err) {
console.error(err);
});

// Or obtain the paged response.
var formattedName = client.projectPath(projectId);


var options = {autoPaginate: false};
function callback(responses) {
// The actual resources in a response.
var resources = responses[0];
// The next request if the response shows there's more responses.
var nextRequest = responses[1];
// The actual response object, if necessary.
// var rawResponse = responses[2];
for (var i = 0; i < resources.length; ++i) {
// doThingsWith(resources[i]);
}
if (nextRequest) {
// Fetch the next page.
return client.listMonitoredResourceDescriptors(nextRequest, options).then(callback);
}
}
client.listMonitoredResourceDescriptors({name: formattedName}, options)
.then(callback)
.catch(function(err) {
console.error(err);
});
```

### Next Steps
- Read the [Client Library Documentation][] for Stackdriver Monitoring API to see other available methods on the client.
- Read the [Stackdriver Monitoring API Product documentation][Product Documentation] to learn more about the product and see How-to Guides.
- View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/README.md) to see the full list of Cloud APIs that we cover.

[Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-node/#/docs/monitoring
[Product Documentation]: https://cloud.google.com/monitoring
41 changes: 29 additions & 12 deletions generated/nodejs/monitoring/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
{
"url": "https://github.com/googleapis/googleapis",
"repository": "GoogleCloudPlatform/google-cloud-node",
"name": "@google-cloud/monitoring",
"version": "0.7.1",
"version": "0.3.0",
"author": "Google Inc",
"description": "Stackdriver Monitoring API client for Node.js",
"main": "src/index.js",
"files": [
"src"
"src",
"AUTHORS",
"COPYING"
],
"keywords": [
"google apis client",
"google api client",
"google apis",
"google api",
"google",
"google cloud platform",
"google cloud",
"cloud",
"google monitoring",
"monitoring",
"Stackdriver Monitoring API"
],
"dependencies": {
"extend": "^3.0.0",
"google-gax": "^0.12.3",
"google-proto-files": "^0.8.6",
"extend": "^3.0",
"google-gax": "^0.13.2",
"google-proto-files": "^0.12.0",
"lodash.union": "^4.6.0"
},
"devDependencies": {
"mocha": "3.2.0",
"through2": "2.0.3"
"mocha": "^3.2.0",
"through2": "^2.0.3"
},
"scripts": {
"publish-module": "node ../../scripts/publish.js monitoring",
"smoke-test": "mocha smoke-test/*.js --timeout 5000",
"test": "mocha test/*.js"
},
"license": "Apache-2.0",
"engines": {
"node": ">=0.12.0"
},
"scripts": {
"test": "mocha"
"node": ">=4.0.0"
}
}
Loading