diff --git a/generated/nodejs/monitoring/LICENSE b/generated/nodejs/monitoring/LICENSE deleted file mode 100644 index 724a88071..000000000 --- a/generated/nodejs/monitoring/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/generated/nodejs/monitoring/README.md b/generated/nodejs/monitoring/README.md index 68f882015..97d1438bd 100644 --- a/generated/nodejs/monitoring/README.md +++ b/generated/nodejs/monitoring/README.md @@ -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 \ No newline at end of file diff --git a/generated/nodejs/monitoring/package.json b/generated/nodejs/monitoring/package.json index a51018855..133b9322e 100644 --- a/generated/nodejs/monitoring/package.json +++ b/generated/nodejs/monitoring/package.json @@ -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" } } diff --git a/generated/nodejs/monitoring/smoke-test/metric_service_smoke_test.js b/generated/nodejs/monitoring/smoke-test/metric_service_smoke_test.js new file mode 100644 index 000000000..546683030 --- /dev/null +++ b/generated/nodejs/monitoring/smoke-test/metric_service_smoke_test.js @@ -0,0 +1,92 @@ +/* + * Copyright 2017, 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. + */ +'use strict'; + +describe('MetricServiceSmokeTest', function() { + if (!process.env.SMOKE_TEST_PROJECT) { + throw new Error("Usage: SMOKE_TEST_PROJECT= node #{$0}"); + } + var projectId = process.env.SMOKE_TEST_PROJECT; + + it('successfully makes a call to the service using promises', function(done) { + var monitoring = require('../src'); + + var client = monitoring.v3.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) { + console.log(resources[i]); + } + }) + .then(done) + .catch(done); + }); + + it('successfully makes a call to the service using callbacks', function(done) { + var monitoring = require('../src'); + + var client = monitoring.v3.metric({ + // optional auth parameters. + }); + + // 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) { + console.log(resources[i]) + } + if (nextRequest) { + // Fetch the next page. + return client.listMonitoredResourceDescriptors(nextRequest, options).then(callback); + } + } + client.listMonitoredResourceDescriptors({name: formattedName}, options) + .then(callback) + .then(done) + .catch(done); + }); + + it('successfully makes a call to the service using streaming', function(done) { + var monitoring = require('../src'); + + var client = monitoring.v3.metric({ + // optional auth parameters. + }); + + var formattedName = client.projectPath(projectId); + client.listMonitoredResourceDescriptorsStream({name: formattedName}) + .on('data', function(element) { + console.log(element); + }) + .on('error', done) + .on('end', done); + }); +}); \ No newline at end of file diff --git a/generated/nodejs/monitoring/src/index.js b/generated/nodejs/monitoring/src/index.js index 804d2badd..c1507b77a 100644 --- a/generated/nodejs/monitoring/src/index.js +++ b/generated/nodejs/monitoring/src/index.js @@ -1,11 +1,11 @@ /* - * Copyright 2016 Google Inc. All rights reserved. + * Copyright 2017, 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 + * 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, @@ -15,4 +15,91 @@ */ 'use strict'; -module.exports.v3 = require('./v3'); +var extend = require('extend'); +var gapic = { + v3: require('./v3') +}; +var gaxGrpc = require('google-gax').grpc(); + +const VERSION = require('../package.json').version; + +/** + * Create an groupServiceClient with additional helpers for common + * tasks. + * + * The Group API lets you inspect and manage your + * [groups](https://cloud.google.comgoogle.monitoring.v3.Group). + * + * A group is a named filter that is used to identify + * a collection of monitored resources. Groups are typically used to + * mirror the physical and/or logical topology of the environment. + * Because group membership is computed dynamically, monitored + * resources that are started in the future are automatically placed + * in matching groups. By using a group to name monitored resources in, + * for example, an alert policy, the target of that alert policy is + * updated automatically as monitored resources are added and removed + * from the infrastructure. + * + * @param {object=} options - [Configuration object](#/docs). + * @param {number=} options.port - The port on which to connect to + * the remote host. + * @param {string=} options.servicePath - The domain name of the + * API remote host. + */ +function groupV3(options) { + // Define the header options. + options = extend({}, options, { + libName: 'gccl', + libVersion: VERSION + }); + + // Create the client with the provided options. + var client = gapic.v3(options).groupServiceClient(options); + return client; +} + +/** + * Create an metricServiceClient with additional helpers for common + * tasks. + * + * Manages metric descriptors, monitored resource descriptors, and + * time series data. + * + * @param {object=} options - [Configuration object](#/docs). + * @param {number=} options.port - The port on which to connect to + * the remote host. + * @param {string=} options.servicePath - The domain name of the + * API remote host. + */ +function metricV3(options) { + // Define the header options. + options = extend({}, options, { + libName: 'gccl', + libVersion: VERSION + }); + + // Create the client with the provided options. + var client = gapic.v3(options).metricServiceClient(options); + return client; +} + +var v3Protos = {}; + +extend(v3Protos, gaxGrpc.load([{ + root: require('google-proto-files')('..'), + file: 'google/monitoring/v3/group_service.proto' +}]).google.monitoring.v3); + +extend(v3Protos, gaxGrpc.load([{ + root: require('google-proto-files')('..'), + file: 'google/monitoring/v3/metric_service.proto' +}]).google.monitoring.v3); + +module.exports.group = groupV3; +module.exports.metric = metricV3; +module.exports.types = v3Protos; + +module.exports.v3 = {}; +module.exports.v3.group = groupV3; +module.exports.v3.metric = metricV3; +module.exports.v3.types = v3Protos; \ No newline at end of file diff --git a/generated/nodejs/monitoring/src/v3/group_service_client.js b/generated/nodejs/monitoring/src/v3/group_service_client.js index 1cab7077a..4f11033ae 100644 --- a/generated/nodejs/monitoring/src/v3/group_service_client.js +++ b/generated/nodejs/monitoring/src/v3/group_service_client.js @@ -1,11 +1,11 @@ /* - * Copyright 2016 Google Inc. All rights reserved. + * Copyright 2017, 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 + * 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, @@ -35,7 +35,7 @@ var SERVICE_ADDRESS = 'monitoring.googleapis.com'; var DEFAULT_SERVICE_PORT = 443; -var CODE_GEN_NAME_VERSION = 'gapic/0.7.1'; +var CODE_GEN_NAME_VERSION = 'gapic/0.0.5'; var PAGE_DESCRIPTORS = { listGroups: new gax.PageDescriptor( @@ -73,15 +73,6 @@ var ALL_SCOPES = [ * updated automatically as monitored resources are added and removed * from the infrastructure. * - * This will be created through a builder function which can be obtained by the module. - * See the following example of how to initialize the module and how to access to the builder. - * @see {@link groupServiceClient} - * - * @example - * var monitoringV3 = require('@google-cloud/monitoring').v3({ - * // optional auth parameters. - * }); - * var client = monitoringV3.groupServiceClient(); * * @class */ @@ -156,16 +147,6 @@ GroupServiceClient.prototype.projectPath = function(project) { }); }; -/** - * Parses the projectName from a project resource. - * @param {String} projectName - * A fully-qualified path representing a project resources. - * @returns {String} - A string representing the project. - */ -GroupServiceClient.prototype.matchProjectFromProjectName = function(projectName) { - return PROJECT_PATH_TEMPLATE.match(projectName).project; -}; - /** * Returns a fully-qualified group resource name string. * @param {String} project @@ -179,6 +160,16 @@ GroupServiceClient.prototype.groupPath = function(project, group) { }); }; +/** + * Parses the projectName from a project resource. + * @param {String} projectName + * A fully-qualified path representing a project resources. + * @returns {String} - A string representing the project. + */ +GroupServiceClient.prototype.matchProjectFromProjectName = function(projectName) { + return PROJECT_PATH_TEMPLATE.match(projectName).project; +}; + /** * Parses the groupName from a group resource. * @param {String} groupName @@ -201,7 +192,7 @@ GroupServiceClient.prototype.matchGroupFromGroupName = function(groupName) { /** * Get the project ID used by this class. - * @aram {function(Error, string)} callback - the callback to be called with + * @param {function(Error, string)} callback - the callback to be called with * the current project Id. */ GroupServiceClient.prototype.getProjectId = function(callback) { @@ -264,19 +255,29 @@ GroupServiceClient.prototype.getProjectId = function(callback) { * * @example * - * var client = monitoringV3.groupServiceClient(); - * var formattedName = client.projectPath("[PROJECT]"); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.group({ + * // optional auth parameters. + * }); + * * // Iterate over all elements. + * var formattedName = client.projectPath("[PROJECT]"); + * * client.listGroups({name: formattedName}).then(function(responses) { * var resources = responses[0]; * for (var i = 0; i < resources.length; ++i) { * // doThingsWith(resources[i]) * } - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); * * // Or obtain the paged response. + * var formattedName = client.projectPath("[PROJECT]"); + * + * * var options = {autoPaginate: false}; * function callback(responses) { * // The actual resources in a response. @@ -358,12 +359,18 @@ GroupServiceClient.prototype.listGroups = function(request, options, callback) { * * @example * - * var client = monitoringV3.groupServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.group({ + * // optional auth parameters. + * }); + * * var formattedName = client.projectPath("[PROJECT]"); - * client.listGroupsStream({name: formattedName}).on('data', function(element) { + * client.listGroupsStream({name: formattedName}) + * .on('data', function(element) { * // doThingsWith(element) * }).on('error', function(err) { - * console.error(err); + * console.log(err); * }); */ GroupServiceClient.prototype.listGroupsStream = function(request, options) { @@ -395,12 +402,18 @@ GroupServiceClient.prototype.listGroupsStream = function(request, options) { * * @example * - * var client = monitoringV3.groupServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.group({ + * // optional auth parameters. + * }); + * * var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); * client.getGroup({name: formattedName}).then(function(responses) { * var response = responses[0]; * // doThingsWith(response) - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); */ @@ -444,7 +457,12 @@ GroupServiceClient.prototype.getGroup = function(request, options, callback) { * * @example * - * var client = monitoringV3.groupServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.group({ + * // optional auth parameters. + * }); + * * var formattedName = client.projectPath("[PROJECT]"); * var group = {}; * var request = { @@ -454,7 +472,8 @@ GroupServiceClient.prototype.getGroup = function(request, options, callback) { * client.createGroup(request).then(function(responses) { * var response = responses[0]; * // doThingsWith(response) - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); */ @@ -496,12 +515,18 @@ GroupServiceClient.prototype.createGroup = function(request, options, callback) * * @example * - * var client = monitoringV3.groupServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.group({ + * // optional auth parameters. + * }); + * * var group = {}; * client.updateGroup({group: group}).then(function(responses) { * var response = responses[0]; * // doThingsWith(response) - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); */ @@ -535,7 +560,12 @@ GroupServiceClient.prototype.updateGroup = function(request, options, callback) * * @example * - * var client = monitoringV3.groupServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.group({ + * // optional auth parameters. + * }); + * * var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); * client.deleteGroup({name: formattedName}).catch(function(err) { * console.error(err); @@ -607,19 +637,29 @@ GroupServiceClient.prototype.deleteGroup = function(request, options, callback) * * @example * - * var client = monitoringV3.groupServiceClient(); - * var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.group({ + * // optional auth parameters. + * }); + * * // Iterate over all elements. + * var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); + * * client.listGroupMembers({name: formattedName}).then(function(responses) { * var resources = responses[0]; * for (var i = 0; i < resources.length; ++i) { * // doThingsWith(resources[i]) * } - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); * * // Or obtain the paged response. + * var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); + * + * * var options = {autoPaginate: false}; * function callback(responses) { * // The actual resources in a response. @@ -701,12 +741,18 @@ GroupServiceClient.prototype.listGroupMembers = function(request, options, callb * * @example * - * var client = monitoringV3.groupServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.group({ + * // optional auth parameters. + * }); + * * var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); - * client.listGroupMembersStream({name: formattedName}).on('data', function(element) { + * client.listGroupMembersStream({name: formattedName}) + * .on('data', function(element) { * // doThingsWith(element) * }).on('error', function(err) { - * console.error(err); + * console.log(err); * }); */ GroupServiceClient.prototype.listGroupMembersStream = function(request, options) { diff --git a/generated/nodejs/monitoring/src/v3/group_service_client_config.json b/generated/nodejs/monitoring/src/v3/group_service_client_config.json index 825193b3a..a57878c2e 100644 --- a/generated/nodejs/monitoring/src/v3/group_service_client_config.json +++ b/generated/nodejs/monitoring/src/v3/group_service_client_config.json @@ -6,9 +6,7 @@ "DEADLINE_EXCEEDED", "UNAVAILABLE" ], - "non_idempotent": [ - "UNAVAILABLE" - ] + "non_idempotent": [] }, "retry_params": { "default": { diff --git a/generated/nodejs/monitoring/src/v3/index.js b/generated/nodejs/monitoring/src/v3/index.js index e87d3eff5..29344a5c2 100644 --- a/generated/nodejs/monitoring/src/v3/index.js +++ b/generated/nodejs/monitoring/src/v3/index.js @@ -1,11 +1,11 @@ /* - * Copyright 2016 Google Inc. All rights reserved. + * Copyright 2017, 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 + * 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, @@ -32,10 +32,11 @@ function v3(options) { return result; } +v3.GAPIC_VERSION = '0.0.5'; v3.SERVICE_ADDRESS = groupServiceClient.SERVICE_ADDRESS; v3.ALL_SCOPES = union( groupServiceClient.ALL_SCOPES, metricServiceClient.ALL_SCOPES ); -module.exports = v3; +module.exports = v3; \ No newline at end of file diff --git a/generated/nodejs/monitoring/src/v3/metric_service_client.js b/generated/nodejs/monitoring/src/v3/metric_service_client.js index 62706b2ff..59d0eb016 100644 --- a/generated/nodejs/monitoring/src/v3/metric_service_client.js +++ b/generated/nodejs/monitoring/src/v3/metric_service_client.js @@ -1,11 +1,11 @@ /* - * Copyright 2016 Google Inc. All rights reserved. + * Copyright 2017, 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 + * 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, @@ -35,7 +35,7 @@ var SERVICE_ADDRESS = 'monitoring.googleapis.com'; var DEFAULT_SERVICE_PORT = 443; -var CODE_GEN_NAME_VERSION = 'gapic/0.7.1'; +var CODE_GEN_NAME_VERSION = 'gapic/0.0.5'; var PAGE_DESCRIPTORS = { listMonitoredResourceDescriptors: new gax.PageDescriptor( @@ -67,15 +67,6 @@ var ALL_SCOPES = [ * Manages metric descriptors, monitored resource descriptors, and * time series data. * - * This will be created through a builder function which can be obtained by the module. - * See the following example of how to initialize the module and how to access to the builder. - * @see {@link metricServiceClient} - * - * @example - * var monitoringV3 = require('@google-cloud/monitoring').v3({ - * // optional auth parameters. - * }); - * var client = monitoringV3.metricServiceClient(); * * @class */ @@ -155,16 +146,6 @@ MetricServiceClient.prototype.projectPath = function(project) { }); }; -/** - * Parses the projectName from a project resource. - * @param {String} projectName - * A fully-qualified path representing a project resources. - * @returns {String} - A string representing the project. - */ -MetricServiceClient.prototype.matchProjectFromProjectName = function(projectName) { - return PROJECT_PATH_TEMPLATE.match(projectName).project; -}; - /** * Returns a fully-qualified metric_descriptor resource name string. * @param {String} project @@ -178,6 +159,29 @@ MetricServiceClient.prototype.metricDescriptorPath = function(project, metricDes }); }; +/** + * Returns a fully-qualified monitored_resource_descriptor resource name string. + * @param {String} project + * @param {String} monitoredResourceDescriptor + * @returns {String} + */ +MetricServiceClient.prototype.monitoredResourceDescriptorPath = function(project, monitoredResourceDescriptor) { + return MONITORED_RESOURCE_DESCRIPTOR_PATH_TEMPLATE.render({ + project: project, + monitored_resource_descriptor: monitoredResourceDescriptor + }); +}; + +/** + * Parses the projectName from a project resource. + * @param {String} projectName + * A fully-qualified path representing a project resources. + * @returns {String} - A string representing the project. + */ +MetricServiceClient.prototype.matchProjectFromProjectName = function(projectName) { + return PROJECT_PATH_TEMPLATE.match(projectName).project; +}; + /** * Parses the metricDescriptorName from a metric_descriptor resource. * @param {String} metricDescriptorName @@ -198,19 +202,6 @@ MetricServiceClient.prototype.matchMetricDescriptorFromMetricDescriptorName = fu return METRIC_DESCRIPTOR_PATH_TEMPLATE.match(metricDescriptorName).metric_descriptor; }; -/** - * Returns a fully-qualified monitored_resource_descriptor resource name string. - * @param {String} project - * @param {String} monitoredResourceDescriptor - * @returns {String} - */ -MetricServiceClient.prototype.monitoredResourceDescriptorPath = function(project, monitoredResourceDescriptor) { - return MONITORED_RESOURCE_DESCRIPTOR_PATH_TEMPLATE.render({ - project: project, - monitored_resource_descriptor: monitoredResourceDescriptor - }); -}; - /** * Parses the monitoredResourceDescriptorName from a monitored_resource_descriptor resource. * @param {String} monitoredResourceDescriptorName @@ -233,7 +224,7 @@ MetricServiceClient.prototype.matchMonitoredResourceDescriptorFromMonitoredResou /** * Get the project ID used by this class. - * @aram {function(Error, string)} callback - the callback to be called with + * @param {function(Error, string)} callback - the callback to be called with * the current project Id. */ MetricServiceClient.prototype.getProjectId = function(callback) { @@ -289,19 +280,29 @@ MetricServiceClient.prototype.getProjectId = function(callback) { * * @example * - * var client = monitoringV3.metricServiceClient(); - * var formattedName = client.projectPath("[PROJECT]"); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * * // Iterate over all elements. + * var formattedName = client.projectPath("[PROJECT]"); + * * 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) { + * }) + * .catch(function(err) { * console.error(err); * }); * * // Or obtain the paged response. + * var formattedName = client.projectPath("[PROJECT]"); + * + * * var options = {autoPaginate: false}; * function callback(responses) { * // The actual resources in a response. @@ -376,12 +377,18 @@ MetricServiceClient.prototype.listMonitoredResourceDescriptors = function(reques * * @example * - * var client = monitoringV3.metricServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * * var formattedName = client.projectPath("[PROJECT]"); - * client.listMonitoredResourceDescriptorsStream({name: formattedName}).on('data', function(element) { + * client.listMonitoredResourceDescriptorsStream({name: formattedName}) + * .on('data', function(element) { * // doThingsWith(element) * }).on('error', function(err) { - * console.error(err); + * console.log(err); * }); */ MetricServiceClient.prototype.listMonitoredResourceDescriptorsStream = function(request, options) { @@ -415,12 +422,18 @@ MetricServiceClient.prototype.listMonitoredResourceDescriptorsStream = function( * * @example * - * var client = monitoringV3.metricServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * * var formattedName = client.monitoredResourceDescriptorPath("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]"); * client.getMonitoredResourceDescriptor({name: formattedName}).then(function(responses) { * var response = responses[0]; * // doThingsWith(response) - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); */ @@ -484,19 +497,29 @@ MetricServiceClient.prototype.getMonitoredResourceDescriptor = function(request, * * @example * - * var client = monitoringV3.metricServiceClient(); - * var formattedName = client.projectPath("[PROJECT]"); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * * // Iterate over all elements. + * var formattedName = client.projectPath("[PROJECT]"); + * * client.listMetricDescriptors({name: formattedName}).then(function(responses) { * var resources = responses[0]; * for (var i = 0; i < resources.length; ++i) { * // doThingsWith(resources[i]) * } - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); * * // Or obtain the paged response. + * var formattedName = client.projectPath("[PROJECT]"); + * + * * var options = {autoPaginate: false}; * function callback(responses) { * // The actual resources in a response. @@ -572,12 +595,18 @@ MetricServiceClient.prototype.listMetricDescriptors = function(request, options, * * @example * - * var client = monitoringV3.metricServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * * var formattedName = client.projectPath("[PROJECT]"); - * client.listMetricDescriptorsStream({name: formattedName}).on('data', function(element) { + * client.listMetricDescriptorsStream({name: formattedName}) + * .on('data', function(element) { * // doThingsWith(element) * }).on('error', function(err) { - * console.error(err); + * console.log(err); * }); */ MetricServiceClient.prototype.listMetricDescriptorsStream = function(request, options) { @@ -611,12 +640,18 @@ MetricServiceClient.prototype.listMetricDescriptorsStream = function(request, op * * @example * - * var client = monitoringV3.metricServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * * var formattedName = client.metricDescriptorPath("[PROJECT]", "[METRIC_DESCRIPTOR]"); * client.getMetricDescriptor({name: formattedName}).then(function(responses) { * var response = responses[0]; * // doThingsWith(response) - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); */ @@ -660,7 +695,12 @@ MetricServiceClient.prototype.getMetricDescriptor = function(request, options, c * * @example * - * var client = monitoringV3.metricServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * * var formattedName = client.projectPath("[PROJECT]"); * var metricDescriptor = {}; * var request = { @@ -670,7 +710,8 @@ MetricServiceClient.prototype.getMetricDescriptor = function(request, options, c * client.createMetricDescriptor(request).then(function(responses) { * var response = responses[0]; * // doThingsWith(response) - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); */ @@ -707,7 +748,12 @@ MetricServiceClient.prototype.createMetricDescriptor = function(request, options * * @example * - * var client = monitoringV3.metricServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * * var formattedName = client.metricDescriptorPath("[PROJECT]", "[METRIC_DESCRIPTOR]"); * client.deleteMetricDescriptor({name: formattedName}).catch(function(err) { * console.error(err); @@ -792,28 +838,47 @@ MetricServiceClient.prototype.deleteMetricDescriptor = function(request, options * * @example * - * var client = monitoringV3.metricServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * + * // Iterate over all elements. * var formattedName = client.projectPath("[PROJECT]"); * var filter = ''; * var interval = {}; - * var view = monitoringV3.ListTimeSeriesRequest.TimeSeriesView.FULL; + * var view = monitoring.v3.types.ListTimeSeriesRequest.TimeSeriesView.FULL; * var request = { * name: formattedName, * filter: filter, * interval: interval, * view: view * }; - * // Iterate over all elements. + * * client.listTimeSeries(request).then(function(responses) { * var resources = responses[0]; * for (var i = 0; i < resources.length; ++i) { * // doThingsWith(resources[i]) * } - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); * * // Or obtain the paged response. + * var formattedName = client.projectPath("[PROJECT]"); + * var filter = ''; + * var interval = {}; + * var view = monitoring.v3.types.ListTimeSeriesRequest.TimeSeriesView.FULL; + * var request = { + * name: formattedName, + * filter: filter, + * interval: interval, + * view: view + * }; + * + * * var options = {autoPaginate: false}; * function callback(responses) { * // The actual resources in a response. @@ -908,21 +973,27 @@ MetricServiceClient.prototype.listTimeSeries = function(request, options, callba * * @example * - * var client = monitoringV3.metricServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * * var formattedName = client.projectPath("[PROJECT]"); * var filter = ''; * var interval = {}; - * var view = monitoringV3.ListTimeSeriesRequest.TimeSeriesView.FULL; + * var view = monitoring.v3.types.ListTimeSeriesRequest.TimeSeriesView.FULL; * var request = { * name: formattedName, * filter: filter, * interval: interval, * view: view * }; - * client.listTimeSeriesStream(request).on('data', function(element) { + * client.listTimeSeriesStream(request) + * .on('data', function(element) { * // doThingsWith(element) * }).on('error', function(err) { - * console.error(err); + * console.log(err); * }); */ MetricServiceClient.prototype.listTimeSeriesStream = function(request, options) { @@ -962,7 +1033,12 @@ MetricServiceClient.prototype.listTimeSeriesStream = function(request, options) * * @example * - * var client = monitoringV3.metricServiceClient(); + * var monitoring = require('@google-cloud/monitoring'); + * + * var client = monitoring.v3.metric({ + * // optional auth parameters. + * }); + * * var formattedName = client.projectPath("[PROJECT]"); * var timeSeries = []; * var request = { diff --git a/generated/nodejs/monitoring/src/v3/metric_service_client_config.json b/generated/nodejs/monitoring/src/v3/metric_service_client_config.json index b04f72277..15f82ab15 100644 --- a/generated/nodejs/monitoring/src/v3/metric_service_client_config.json +++ b/generated/nodejs/monitoring/src/v3/metric_service_client_config.json @@ -6,9 +6,7 @@ "DEADLINE_EXCEEDED", "UNAVAILABLE" ], - "non_idempotent": [ - "UNAVAILABLE" - ] + "non_idempotent": [] }, "retry_params": { "default": { diff --git a/generated/nodejs/monitoring/test/test.js b/generated/nodejs/monitoring/test/gapic-v3.js similarity index 92% rename from generated/nodejs/monitoring/test/test.js rename to generated/nodejs/monitoring/test/gapic-v3.js index fe12a745e..838498b3b 100644 --- a/generated/nodejs/monitoring/test/test.js +++ b/generated/nodejs/monitoring/test/gapic-v3.js @@ -1,11 +1,11 @@ /* - * Copyright 2016 Google Inc. All rights reserved. + * Copyright 2017, 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 + * 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, @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +'use strict'; var assert = require('assert'); -var monitoringV3 = require('../src/').v3(); +var monitoring = require('../src'); var FAKE_STATUS_CODE = 1; var error = new Error(); @@ -24,7 +25,8 @@ error.code = FAKE_STATUS_CODE; describe('GroupServiceClient', function() { describe('listGroups', function() { it('invokes listGroups without error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var request = { @@ -54,7 +56,8 @@ describe('GroupServiceClient', function() { }); it('invokes listGroups with error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var request = { @@ -74,7 +77,8 @@ describe('GroupServiceClient', function() { describe('getGroup', function() { it('invokes getGroup without error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); var request = { @@ -106,7 +110,8 @@ describe('GroupServiceClient', function() { }); it('invokes getGroup with error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); var request = { @@ -126,7 +131,8 @@ describe('GroupServiceClient', function() { describe('createGroup', function() { it('invokes createGroup without error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var group = {}; @@ -160,7 +166,8 @@ describe('GroupServiceClient', function() { }); it('invokes createGroup with error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var group = {}; @@ -182,7 +189,8 @@ describe('GroupServiceClient', function() { describe('updateGroup', function() { it('invokes updateGroup without error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var group = {}; var request = { @@ -214,7 +222,8 @@ describe('GroupServiceClient', function() { }); it('invokes updateGroup with error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var group = {}; var request = { @@ -234,7 +243,8 @@ describe('GroupServiceClient', function() { describe('deleteGroup', function() { it('invokes deleteGroup without error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); var request = { @@ -251,7 +261,8 @@ describe('GroupServiceClient', function() { }); it('invokes deleteGroup with error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); var request = { @@ -271,7 +282,8 @@ describe('GroupServiceClient', function() { describe('listGroupMembers', function() { it('invokes listGroupMembers without error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); var request = { @@ -303,7 +315,8 @@ describe('GroupServiceClient', function() { }); it('invokes listGroupMembers with error', function(done) { - var client = monitoringV3.groupServiceClient(); + var client = monitoring.v3.group(); + // Mock request var formattedName = client.groupPath("[PROJECT]", "[GROUP]"); var request = { @@ -325,7 +338,8 @@ describe('GroupServiceClient', function() { describe('MetricServiceClient', function() { describe('listMonitoredResourceDescriptors', function() { it('invokes listMonitoredResourceDescriptors without error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var request = { @@ -355,7 +369,8 @@ describe('MetricServiceClient', function() { }); it('invokes listMonitoredResourceDescriptors with error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var request = { @@ -375,7 +390,8 @@ describe('MetricServiceClient', function() { describe('getMonitoredResourceDescriptor', function() { it('invokes getMonitoredResourceDescriptor without error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.monitoredResourceDescriptorPath("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]"); var request = { @@ -405,7 +421,8 @@ describe('MetricServiceClient', function() { }); it('invokes getMonitoredResourceDescriptor with error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.monitoredResourceDescriptorPath("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]"); var request = { @@ -425,7 +442,8 @@ describe('MetricServiceClient', function() { describe('listMetricDescriptors', function() { it('invokes listMetricDescriptors without error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var request = { @@ -455,7 +473,8 @@ describe('MetricServiceClient', function() { }); it('invokes listMetricDescriptors with error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var request = { @@ -475,7 +494,8 @@ describe('MetricServiceClient', function() { describe('getMetricDescriptor', function() { it('invokes getMetricDescriptor without error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.metricDescriptorPath("[PROJECT]", "[METRIC_DESCRIPTOR]"); var request = { @@ -507,7 +527,8 @@ describe('MetricServiceClient', function() { }); it('invokes getMetricDescriptor with error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.metricDescriptorPath("[PROJECT]", "[METRIC_DESCRIPTOR]"); var request = { @@ -527,7 +548,8 @@ describe('MetricServiceClient', function() { describe('createMetricDescriptor', function() { it('invokes createMetricDescriptor without error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var metricDescriptor = {}; @@ -561,7 +583,8 @@ describe('MetricServiceClient', function() { }); it('invokes createMetricDescriptor with error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var metricDescriptor = {}; @@ -583,7 +606,8 @@ describe('MetricServiceClient', function() { describe('deleteMetricDescriptor', function() { it('invokes deleteMetricDescriptor without error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.metricDescriptorPath("[PROJECT]", "[METRIC_DESCRIPTOR]"); var request = { @@ -600,7 +624,8 @@ describe('MetricServiceClient', function() { }); it('invokes deleteMetricDescriptor with error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.metricDescriptorPath("[PROJECT]", "[METRIC_DESCRIPTOR]"); var request = { @@ -620,12 +645,13 @@ describe('MetricServiceClient', function() { describe('listTimeSeries', function() { it('invokes listTimeSeries without error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var filter = 'filter-1274492040'; var interval = {}; - var view = monitoringV3.ListTimeSeriesRequest.TimeSeriesView.FULL; + var view = monitoring.v3.types.ListTimeSeriesRequest.TimeSeriesView.FULL; var request = { name : formattedName, filter : filter, @@ -656,12 +682,13 @@ describe('MetricServiceClient', function() { }); it('invokes listTimeSeries with error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var filter = 'filter-1274492040'; var interval = {}; - var view = monitoringV3.ListTimeSeriesRequest.TimeSeriesView.FULL; + var view = monitoring.v3.types.ListTimeSeriesRequest.TimeSeriesView.FULL; var request = { name : formattedName, filter : filter, @@ -682,7 +709,8 @@ describe('MetricServiceClient', function() { describe('createTimeSeries', function() { it('invokes createTimeSeries without error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var timeSeries = []; @@ -701,7 +729,8 @@ describe('MetricServiceClient', function() { }); it('invokes createTimeSeries with error', function(done) { - var client = monitoringV3.metricServiceClient(); + var client = monitoring.v3.metric(); + // Mock request var formattedName = client.projectPath("[PROJECT]"); var timeSeries = [];